浏览代码

分离Gateway辅助开发工具

airhead 8 年之前
父节点
当前提交
9fcd8d5c25

+ 3 - 7
hos-camel2/src/main/java/camel/gateway/route/GatewayRouterBuilder.java

@ -2,7 +2,6 @@ package camel.gateway.route;
import camel.gateway.processor.ErrorHandle;
import camel.gateway.processor.GatewayProcessor;
import camel.gateway.processor.SignProcessor;
import camel.gateway.processor.WsProcessor;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
@ -38,18 +37,15 @@ public class GatewayRouterBuilder extends RouteBuilder {
                .when(header(Exchange.HTTP_URI).contains("unauthorizedError")).bean(new ErrorHandle(), "unauthorizedError")
                .endChoice();
        from("jetty:http://0.0.0.0:9999/healthy").routeId("healthy")
        from("jetty:http://0.0.0.0:9999/ping").routeId("heartbeat")
                .transform(constant("pong"))
                .log("=========================心跳测试=====================");
        from("jetty:http://0.0.0.0:9999/sign").routeId("sign")
                .process(new SignProcessor());
        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")
        ;
                .to("bean:wsProcessor?method=responseWs");
    }
}

+ 18 - 0
hos-camel2/src/main/java/camel/gateway/route/GatewayToolBuilder.java

@ -0,0 +1,18 @@
package camel.gateway.route;
import camel.gateway.processor.SignProcessor;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
/**
 * 网关辅助工具路由,用于生成签名等内容。不要要发布到生产环境中。
 * Created by l4qiang on 2017-06-13.
 */
@Component
public class GatewayToolBuilder extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("jetty:http://0.0.0.0:9999/sign").routeId("sign")
                .process(new SignProcessor());
    }
}