完整的异步Web服务通信-发送方和接收方无法同时使用 [英] Complete Async web service communication - sender and receiver are not available same time

查看:135
本文介绍了完整的异步Web服务通信-发送方和接收方无法同时使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两个系统通过集成(使用apache-camel)相互通信.假设系统A需要向已公开Web服务以接收数据的系统B提交请求,并且集成正在按照系统B Web服务转换数据.

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.

在上述场景中,A和B必须同时可用,并且A必须等待来自B的响应.我需要通过将队列放入集成层并进行异步通信来消除此依赖性. 例如:

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>

按照上述方法,即使系统B不可用,路由系统A仍可以提交请求,但路由IntegrationToB仍需要系统B可用,否则它将失败,并在重试后将请求放入死信队列". 因此,我试图弄清楚如何配置路由IntegrationToB仅在系统B可用时运行.

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.

推荐答案

我不太了解,您说过您在系统之间设置了排队机制.好的,但是如果您执行了此操作,则无需知道系统是否可用.该系统将在队列可用时从队列中消耗.

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.

如果您仍然需要从队列发送到Web服务,那么在两者之间使用排队机制有什么意义呢?

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?

这篇关于完整的异步Web服务通信-发送方和接收方无法同时使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆