1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package camel.central.gateway.route;
- import camel.central.gateway.processor.GatewayProcessor;
- import camel.central.gateway.processor.WsProcessor;
- import org.apache.camel.Exchange;
- import org.apache.camel.builder.RouteBuilder;
- import org.springframework.stereotype.Component;
- /**
- * @author HZY
- * @vsrsion 1.0
- * Created at 2017/3/13.
- */
- @Component
- public class GatewayRouterBuilder extends RouteBuilder {
- protected static final String SIMPLE_ENDPOINT_ADDRESS = "http://0.0.0.0:3333/ws/api";
- protected static final String SIMPLE_ENDPOINT_URI = "cxf:" + SIMPLE_ENDPOINT_ADDRESS
- + "?serviceClass=camel.central.gateway.processor.WsService"
- // + "&dataFormat=CXF_MESSAGE"
- ;
- @Override
- public void configure() throws Exception {
- //EHR ag-admin网关代理
- from("jetty:http://0.0.0.0:9998?matchOnUriPrefix=true").routeId("proxy")
- .to("jetty:http://192.168.1.221:10000?bridgeEndpoint=true&throwExceptionOnFailure=false");
- // 档案上传接口代理
- from("jetty:http://0.0.0.0:9990/api/packages?bridgeEndpoint=true&enableMultipartFilter=false").routeId("proxyUploadPack")
- .removeHeaders("CamelHttp*")
- .to("jetty:http://192.168.1.221:10140/api/v1.0/packages");
- //统一网关入口(restful)
- from("jetty:http://0.0.0.0:9999/api").routeId("api")
- .process(new GatewayProcessor())
- .routingSlip(method(GatewayProcessor.class, "route"));
- //统一网关入口(web-service)
- from(SIMPLE_ENDPOINT_URI)
- .setHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY, constant(true))
- .process(new WsProcessor())
- .routingSlip(method(GatewayProcessor.class, "route"))
- .to("bean:wsProcessor?method=responseWs");
- //流程健康测试接口
- from("jetty:http://0.0.0.0:9999/healthy").routeId("healthy")
- .log("=========================心跳测试=====================");
- }
- }
|