Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

new to JMS , Que- what approach to take for continously listenning messages  RSS feed

 
rahul batra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
i am new to JMS.
i have a scenario and not am not able to decide the approach to take for it . Please do read it as many of you might already have implemented it .

I have to design a system where in there will be two jms on two different systems running. so for both the systems i will have to define Sender and receiver.

Now the approach would be something like , if one of the JMS sends some messages lets say in xml format then the other JMS should be able to immidiately receive that mesage and operate on it and vice versa.

so my problems and confusions are .
1)
what type of messaging to use .
Point to Point , or public - subscribe. i mean if say the other JMS sends me a message , then after two seconds it again send some message , and my JMS listened to it only after a minutes then it sould be able to get both messages and should be able to operate on it.

2 Writing sender is fine because that will be based on some action
(if the point 1 is clear i.e where to register the message queue or topic)
However i am confused in writing receiver . How do i continously listen to a jms so that i can read if some message had come and work on that message. and if two messages or say n messages had come then read those messages and operate on them.

So important thing here is my Receiver is continously listening on both the JMS's for the messages.

Please do help me with this. I dont want code but just an approach that solves all this .

Thanks in advance.
 
rahul batra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends, i felt probabaly i wasnt clear in explaining my requirement so in order to clear the confusion i wil try to explain it more .

please do read it .

see i have a web application that will be deployed on Jboss.
so i read data from that web app and stuff it into some message and post it to JMS.. this is one end. so i write a MessageSender which connects to JMS and posts it in say queue or topic.

now on other end , i have web methods B2B product installed on some other system , now Web Methods B2B has its own JMS. now i need to write a MessageReceiver in this product which is listening after fixed interval of time to either queue or topic whatever i had used in my WEBAPP .as soon as some messages is posted it reads that message and operates on it.

Similarly the reverse part. that means i have a MessageSender at webMethods end which generates Messages and posts it to Queue or Topic in its JMS. so now i want a MessageReceiver in My WebAPP deployed in JBOSS, which is listening to webMethods JBOSS after fixed interval of time. if some message is posted on particular queue or topic then it collects that and operates on it.

so i need to know , what messaging type do i use. i.e,
(point-to-point) -> Queue
(Publish - Subscribe) Topic

and also how to write the MessageReceiver.. use what , like can it be done with Multi-Threading . etc
please suggest me a nice approach..

and most importantly this all is going to happen real-time.
thanks.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

Please help me to understand one thing. You�ve saying that you have an Web application deployed on JBoss, which uses it�s own JMS system, probably the JBoss specific one. On the other hand, you have a B2B application which sends/posts messages to its own JMS system, which is maybe another JMS implementation like IBM MQ, or BEA-JMS, or whatever. My question is this: are they really distinct and separate message systems? Does the first application publishes messages in its own JMS environment and expects to receive them from there? Or is it possible to have the JBoss app sends/posts messages to the B2B app�s message systems and receives those in its own message system (and the other way around)?
Regards.
 
rahul batra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Hi Rahul,
>Please help me to understand one thing. You�ve saying that you have an >Web application deployed on JBoss, which uses it�s own JMS system, >probably the JBoss specific one. On the other hand, you have a B2B >application which sends/posts messages to its own JMS system, which is >maybe another JMS implementation like IBM MQ, or BEA-JMS, or whatever. My >question is this: are they really distinct and separate message systems? >Does the first application publishes messages in its own JMS environment >and expects to receive them from there? Or is it possible to have the >JBoss app sends/posts messages to the B2B app�s message systems and >receives those in its own message system (and the other way around)?
>Regards


Hi valentin , first of all thanks for replying. ok this all sounds very confusing . Lets simplyfy it
For the time being lets just say there is my Application deployed on JBOSS which has its JMS. now lets say i have defined a Queue named "MyAppQueue" and i know that all the senders whereever they may be will post there messages on this queue.

Now my responsibility is to write a MessageReceiver which is continously running and checking this queue for messages. whenever it receives a message it immidiately calls the messagesListener which processes the message.

So sow my requirement of Writing such MessageReceiver is that , it should always be in running mode(that means once i start it, it starts forever since this is going to be a REal time application) and continously checking the queue, as soon as some message comes it calls messageListener. and also that this messageReceiver should be fast , i mean coz many messages may come at once say 40-50 messages in a minute.
so please tell me how do i now write this MessageReceiver.

This will solve all my problems.
thanks in advance
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your problem has a very simple and straightforward solution: write and deploy a MDB (message driven bean) to JBoss, and register it (using deployment descriptor configurations) to listen to your topic/queue (MyAppQueue). I'm not a JBoss expert but you can find a lot of samples and documentation about how to implement MDBs with JBoss. Believe me it won't take you more than couple of days to have your POC done. MDBs are very lightweight components and they are very easy to write and comprehend.
Regards.
 
rahul batra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok valentin, thanks for you r help , will look into MDB , though till now i was only trying with simple jms api , and was planning to write my MessageReceiver as a Multithreaded application
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!