ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Asychronous messaging.

Post new topic  Reply to topic
 Asychronous messaging. « View previous topic :: View next topic » 
Author Message
jmw
PostPosted: Tue Apr 26, 2005 9:14 pm    Post subject: Asychronous messaging. Reply with quote

Novice

Joined: 16 Apr 2003
Posts: 19

Hi All,

Can I using MQ for java base class to do asychronous messaging? just like onMessage does in MQ for JMS?

Thanks.
Back to top
View user's profile Send private message
bduncan
PostPosted: Tue Apr 26, 2005 11:22 pm    Post subject: Reply with quote

Padawan

Joined: 11 Apr 2001
Posts: 1554
Location: Silicon Valley

If you are using MQSeries as your transport layer, whether you are using JMS or MQI, your messages will always be put asynchronously. That is an inerhent property of MQSeries.
_________________
Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator
Back to top
View user's profile Send private message Visit poster's website AIM Address
jefflowrey
PostPosted: Wed Apr 27, 2005 3:41 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What brandon says is technically correct, but mostly orthogonal to your actual question.

It's a very good answer...

What environment are you writing in? What problem are you trying to solve?

You can write your own message listener using the MQ API for Java. All of the sample programs that actually get messages count as message listeners.

You need to be careful in some environments - like inside a j2EE container - to ensure that you don't block other things from happening and that you don't create a transactional event inside a non-XA process that already has another transaction...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jmw
PostPosted: Wed Apr 27, 2005 4:46 am    Post subject: Reply with quote

Novice

Joined: 16 Apr 2003
Posts: 19

I want the application listening on a queue, it be notified when a message arriving on the queue.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Apr 27, 2005 4:51 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

MQ@net wrote:
I want the application listening on a queue, it be notified when a message arriving on the queue.


You issue a get and specify a wait time.

Or you use triggering.

You should look at the Application Programming Guide.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jmw
PostPosted: Wed Apr 27, 2005 5:16 am    Post subject: Reply with quote

Novice

Joined: 16 Apr 2003
Posts: 19

Thanks for you reply. But, if using "get", it is still syncronous, as the applicattion has to wait till the certain amout of wait time passed, during this period of time, the application can not do anything else.
What I am looking for in Base class is, somethin like the onMessage() interface in JMS. It notified when message come.
Back to top
View user's profile Send private message
malammik
PostPosted: Wed Apr 27, 2005 6:01 am    Post subject: Reply with quote

Partisan

Joined: 27 Jan 2005
Posts: 397
Location: Philadelphia, PA

onMessage() would only work on J2EE implementation that supports MDBs. WebSphere runs the mq listener which underneath the covers does get with a wait on the queue and when the message arrives it envokes your bean and passet it the message content in the buffer.

Synchronous and Asynchronous need to be viewed in at least two contexts. Logical and Physical. Here is a good example of how a truly asynchronous application is appears to be entirely synchronous to an outsider.

Application W is a java wrapper that communicates with .NET clients via some xml, web services, etc. .NET clients send subscription requests to the wrapper. Wrapper converts the xml into jms subscribe call. Now at this point wrapper can reply back to .NET saying I subscribed you but no he waits for the broker to reply confirming the subscription request. And only then gives back the control to .NET app. This whole time .NET was thinking it was performing a synchronous operation and logically it was however wrapper performed two physical asynchronous requests requested subscription and sending back the reply.

The only thing that I can recommend, it write your own listener and write your own threaded message processor and have the listener invoke whatever method of ur processor interface when the message arrives. Bottom line is somebody's got to have the queue open all the times. Whether it is a listener that's part of WAS or some other j2ee server or your own listener.

Hth.
_________________
Mikhail Malamud
http://www.netflexity.com
http://groups.google.com/group/qflex
Back to top
View user's profile Send private message Visit poster's website AIM Address
jefflowrey
PostPosted: Wed Apr 27, 2005 6:31 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Your main application doesn't have to "wait" until the message arrives.

Just put your message listening subsystem in a different thread.

And don't use the connection handle in your main processing.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Asychronous messaging.
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.