日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Request-reply messaging

發(fā)布時(shí)間:2024/4/17 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Request-reply messaging 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

JMS messaging with Camel (and in general) is asynchronous by default. Messages are

sent to a destination, and the client doesn’t wait for a reply. But there are times when

it’s useful to be able to wait and get a reply after sending to a destination. One obvious

application is when the JMS destination is a frontend to a service—in this case, a client

sending to the destination would be expecting a reply from the service.

JMS supports this type of messaging by providing a JMSReplyTo header, so that the

receiver knows where to send the reply,

and a JMSCorrelationID, used to match

replies to requests if there are multiple

replies awaiting. This flow of messages is

illustrated in figure 7.5.

Camel takes care of this style of messaging,

so you don’t have to create special

reply queues, correlate reply

messages, and the like. By changing the

message exchange pattern (MEP) to

InOut, Camel will enable request-reply

mode for JMS.

To demonstrate, let’s take a look at an order validation service within Rider Auto

Parts’ backend systems that checks orders against the company database to make sure

the parts listed are actual products. This service is exposed via a queue named validate.

The route exposing this service over JMS could be as simple as this:

from("jms:validate").bean(ValidatorBean.class);

?

When calling this service, you just need to tell Camel to use request-reply messaging by

setting the MEP to InOut. You can use the exchangePattern option to set this as follows:

from("jms:incomingOrders").to("jms:validate?exchangePattern=InOut")...

You can also specify the MEP using the inOut DSL method:

from("jms:incomingOrders").inOut().to("jms:validate")...

With the inOut method, you can even pass in an endpoint URI as an argument, which

shortens your route:

from("jms:incomingOrders").inOut("jms:validate")...

By specifying an InOut MEP, Camel will send the message to the validate queue and

wait for a reply on a temporary queue that it creates automatically. When the ValidatorBean

returns a result that message is propagated back to the temporary reply

queue, and the route continues on from there.

Rather than using temporary queues, you can also explicitly specify a reply queue.

This can be done by setting the JMSReplyTo header on the message or by using the

replyTo URI option described in table 7.5.

A handy way of calling an endpoint that can return a response is by using the

request methods of the ProducerTemplate. For example, you can send a message into

the incomingOrders queue and get a response back with the following call:

Object result = template.requestBody("jms:incomingOrders",

"<order name=\"motor\" amount=\"1\" customer=\"honda\"/>");

This will return the result of the ValidatorBean.

To try this out for yourself, go to the chapter7/jms directory in the book’s source,

and run this command:

mvn test -Dtest=RequestReplyJmsTest

The command will run a unit test demonstrating request-reply messaging as we’ve discussed

in this section.

In the JMS examples we’ve looked at so far, several data mappings have been happening

behind the scenes—mappings that are necessary to conform to the JMS specification.

Camel could be transporting any type of data, so that data needs to be

converted to a type that JMS supports. We’ll look into this next.

總結(jié)

以上是生活随笔為你收集整理的Request-reply messaging的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 色中色综合 | 三上悠亚激情av一区二区三区 | 一区二区三区免费播放 | 色噜噜狠狠一区二区 | 免费无码毛片一区二区app | 美女扒开内裤让男人桶 | 美女黄色小视频 | 久久撸视频 | 综合av| 国产三级午夜理伦三级 | 爱爱视频网站 | 丹丹的呻吟声1一7 | 国内精品福利视频 | 性欧美久久久 | 男生操女生在线观看 | 97精品一区| 日韩精品视频在线播放 | 色小姐综合网 | 超碰免费观看 | 色啊色| 成人国产片女人爽到高潮 | 91黄版 | 一区二区亚洲 | 岛国精品在线播放 | 泰剧19禁啪啪无遮挡 | 台湾佬美性中文娱乐网 | 嫩草嫩草嫩草嫩草嫩草 | 国产精品久久久久久久免费大片 | 琪琪色网| 午夜伦伦 | 精品xxx | 亚洲性生活视频 | aa免费视频| 日韩无遮挡 | 黄色av毛片 | 六月婷婷网 | 香蕉视频链接 | 嫩草研究院在线观看 | 深夜激情网站 | 午夜激情影院 | 16—17女人毛片 | 人妻少妇偷人精品久久久任期 | 欧美成人片在线观看 | 亚洲一区二区色图 | 国产乱人乱偷精品视频 | 少妇脱了内裤让我添 | 久久久免费看片 | 国产精品揄拍一区二区 | 女人高潮娇喘1分47秒 | 最好看的2019中文大全在线观看 | 日韩激情毛片 | 成人黄色小视频在线观看 | 免费观看日韩 | 我色综合 | 激情一区二区 | 美女被草出白浆 | 99久久久无码国产精品衣服 | 免费观看久久久 | 欧美人与禽猛交乱配 | 涩色网站 | 天天干夜夜夜夜 | 男女曰逼视频 | 91自啪| 婷婷激情影院 | 国产成人亚洲一区二区 | www.youjizz.com亚洲| 亚洲精品男人的天堂 | 日韩激情一区二区三区 | 精品人妻无码一区 | 在线观看你懂的网址 | 欧美专区在线观看 | 日韩视频一二三区 | 亚洲图色在线 | 国产免费一区视频观看免费 | 日本毛片视频 | 韩国主播青草55部完整 | 欧美视频免费看欧美视频 | 国产精品国产三级国产专播精品人 | 美女三级黄色片 | 国产精品一级黄色片 | 四虎在线免费播放 | 成人一级片视频 | 国产97在线观看 | 午夜寂寞影视 | 亚洲精品国产精品乱码不66 | 亚洲午夜小视频 | 在线免费视频一区二区 | 黄色片在哪里看 | 国产在线视频在线观看 | 九九99视频| 欧美日韩中出 | 性欧美18一19内谢 | 国产精品毛片一区二区在线看 | 黄a网站 | 五月天综合婷婷 | 欧美一区,二区 | 色性av | 日韩一级片 | 色戒在线免费 |