简体   繁体   中英

From a Webapp and with Apache Camel / and using MQ, do you add JMS messages using jsessionid?

I have a web application that will launch a message (say start processing) on the MQ message queue. I have a consumer and the producer configuration defined using the Camel Spring DSL. I want to push a message from a web application and only that session and client should get the response. Could I use the jsessionid and maybe some other random message id to set the message so only that client will get the response?

Eg Imagine Camel Spring DSL xml configuration:

  <route id="webRequestToInRoute">
      <to uri="activemq:queue:inbox :::: here I want to getJsessionId() as the message ... name?"/>
  </route>

More importantly, what are ways that I can communicate between the browser to the camel rest service to the JMS route, mainly to pull the status?

Web app session publishes message

  1. set JMSReplyTo header on the message to: temp-queue://ORDER.$jSessionId
  2. setup a consumer on temp-queue://ORDER.$jSessionId
  3. send to -> queue://PROCESS.ORDER

On the REST service

  1. Consume from queue://PROCESS.ORDER
  2. Do stuff with message
  3. Publish response to temp-queue://ORDER.$jSessionId

Once there are no longer messages, consumers or producers the broker will automatically delete the temp-queue, so there is no clean-up necassary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM