Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using a JMS Queue with SOAP service to exchange XML messages  RSS feed

 
Mo Lin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a program that acts as a server which communicates with a client via SOAP xml messages. The program works synchronously and I need to make it Asynchronous.

The way it works:
The client sends the server a message and the server responds back with its own SOAP message. A full exchange between the client and server can have n number of messages going back and forth. The problem here is that the server might need to wait for the client to send a message somewhere in the middle of the message flow. Server does not know when that message might come in.

I did some research and found out about JMS Queues and how they work with messages. So basically, I want to use these queues to work like this:
- Client sends message
- Add message to a request queue
- Request queue checks to see if it has been waiting for this type of message (can be distinguished by an id that comes with the message).
- If it has, then make a response using that message to finish the message flow from before.
- If it hasn't been waiting for it, then make a new response as it is a new type of message.
- All response messages go to another queue (response queue) where they will, one by one, go back to the client.

Hopefully that made sense. My question is if using JMS Queues is a good way to achieve this? If so, what would I need to learn in order to code this? I followed the tutorial here: A Point-To-Point Example since I am using JBoss AS 5.1. I was able to get that to work so I have a very basic idea on how JMS Queues work.

Further advice and help would be greatly appreciated! Thanks in advance!
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand your description, you're still responding synchronously to each client request.
i.e. client makes a request, server can immediately send back a response.

The "asynchronous" bit you have defined is that the server might be waiting on the client for more information.
Does the server ever directly send a request to the client? Or does it only respond to the clients requests?

I'm not sure that message queues are your solution here.
It sounds more like the server needs to retain state - possibly you want some sort of workflow at the server end rather than a message queue?
 
Mo Lin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the company I work for said they might need to send messages directly so be sure to implement that feature. So I will be adding that in, but right now it simply responds to the client's requests.

I thought JMS Queues retain state? At least on the JBoss server level. It looked to me that JMS Queues would help me save the messages and respond accordingly when the appropriate requests came in (even if the server has to wait) as I couldn't find another solution.

The company suggested me to use them after I told them about it as they use them in other products as them.

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!