GatewayRouterBuilder.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package camel.central.gateway.route;
  2. import camel.central.gateway.processor.GatewayProcessor;
  3. import camel.central.gateway.processor.WsProcessor;
  4. import org.apache.camel.Exchange;
  5. import org.apache.camel.builder.RouteBuilder;
  6. import org.springframework.stereotype.Component;
  7. /**
  8. * @author HZY
  9. * @vsrsion 1.0
  10. * Created at 2017/3/13.
  11. */
  12. @Component
  13. public class GatewayRouterBuilder extends RouteBuilder {
  14. protected static final String SIMPLE_ENDPOINT_ADDRESS = "http://0.0.0.0:3333/ws/api";
  15. protected static final String SIMPLE_ENDPOINT_URI = "cxf:" + SIMPLE_ENDPOINT_ADDRESS
  16. + "?serviceClass=camel.central.gateway.processor.WsService"
  17. // + "&dataFormat=CXF_MESSAGE"
  18. ;
  19. @Override
  20. public void configure() throws Exception {
  21. //EHR ag-admin网关代理
  22. from("jetty:http://0.0.0.0:9998?matchOnUriPrefix=true").routeId("proxy")
  23. .to("jetty:http://192.168.1.221:10000?bridgeEndpoint=true&throwExceptionOnFailure=false");
  24. // 档案上传接口代理
  25. from("jetty:http://0.0.0.0:9990/api/packages?bridgeEndpoint=true&enableMultipartFilter=false").routeId("proxyUploadPack")
  26. .removeHeaders("CamelHttp*")
  27. .to("jetty:http://192.168.1.221:10140/api/v1.0/packages");
  28. //统一网关入口(restful)
  29. from("jetty:http://0.0.0.0:9999/api").routeId("api")
  30. .process(new GatewayProcessor())
  31. .routingSlip(method(GatewayProcessor.class, "route"));
  32. //统一网关入口(web-service)
  33. from(SIMPLE_ENDPOINT_URI)
  34. .setHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY, constant(true))
  35. .process(new WsProcessor())
  36. .routingSlip(method(GatewayProcessor.class, "route"))
  37. .to("bean:wsProcessor?method=responseWs");
  38. //流程健康测试接口
  39. from("jetty:http://0.0.0.0:9999/healthy").routeId("healthy")
  40. .log("=========================心跳测试=====================");
  41. }
  42. }