package qlc.route;

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
import qlc.processor.Processor1;
import qlc.processor.Processor2;

/**
 * Created by lingfeng on 2016/7/25.
 */
public class QlcRouteBulider extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("jetty:http4://172.17.110.178:9088/qlc").routeId("qlc")
                .process(new Processor1()).setHeader(Exchange.HTTP_METHOD, constant("POST")).log("servers: 3,code: queryUserInfo,order: 1")
                .to("http4://172.19.103.89:8088/api/v1.0/qlc/queryUserInfo").log("servers: 3,code: queryUserInfo,order: 1")
                .process(new Processor2()).setHeader(Exchange.HTTP_METHOD, constant("POST")).log("servers: 3,code: patientInformation,order: 1")
                .to("http4://172.19.103.89:8088/api/v1.0/qlc/patientInformation").log("servers: 3,code: patientInformation,order: 1")
                .process(new Processor2()).setHeader(Exchange.HTTP_METHOD, constant("POST")).to("stream:out"); // 2. 为路由配置组件或终端节点.
    }
}
