Complete Async web service communication - sender and receiver are not available same time

China☆狼群 提交于 2020-01-16 08:59:17

问题


Two systems are talking to each other through integration(Using apache-camel). Let say system A needs to submit a request to System B which has exposed a web service to receive data and integration is transforming data as per system B web service.

In above scenario A and B has to be available same time and A will have to wait for response from B. I need to remove this dependency by putting queue at integration layer and with Async communication. Ex:

        <camel:route id="AtoIntegration">
        <camel:from
            uri="spring-ws:someEndPoint" />
        <camel:bean ref="testAsyncPreprocessor" />
        <camel:inOnly uri="activemq:requestqueue" />
    </camel:route>
    <camel:route id="integrationToB">
    <camel:from uri="activemq:requestqueue" />
    <camel:transacted  />
    <camel:bean ref="afterQueueProcessor" />
    <camel:setHeader headerName="CamelHttpMethod">
        <camel:constant>POST</camel:constant>
    </camel:setHeader>
    <camel:setHeader headerName="Content-Type">
        <camel:constant>application/x-www-form-urlencoded</camel:constant>
    </camel:setHeader>
    <camel:to uri="http://localhost:8080/systemB/newOrder?test=testData"
    />
</camel:route>

As per above routing system A can submit request even if system B is not available but route integrationToB still needs system B to be available else it will fail and put request to Dead Letter Queue after retry. So i'm trying to figure out how i can configure route integrationToB only run if system B is available.


回答1:


I don't quite understand, you said you put a queuing mechanism in between the systems. Ok, but if you have done this there is no need to know if a system is available or not. That system will consume from the queue when it becomes available.

If you still need to send from a queue to a web-service then what's the point of having a queuing mechanism in between?



来源:https://stackoverflow.com/questions/48353594/complete-async-web-service-communication-sender-and-receiver-are-not-available

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!