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 API Support » Asynchronously receive message

Post new topic  Reply to topic Goto page 1, 2  Next
 Asynchronously receive message « View previous topic :: View next topic » 
Author Message
mquser01
PostPosted: Mon Mar 24, 2008 4:13 am    Post subject: Asynchronously receive message Reply with quote

Acolyte

Joined: 06 Mar 2008
Posts: 52

I want to get message asynchrously.
Does MQseries provide any such functionality that allows us to receive messages asynchronously?

is there any equivalent for MSMQ PMQRECEIVECALLBACK in MQSeries?
Please help...
Back to top
View user's profile Send private message
Gaya3
PostPosted: Mon Mar 24, 2008 4:21 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

Yes sure..

MQ Supports both asynchrnous and synchronous messages

let me point out here, it works better than MSMQ....

IBM MQ is platform independent

Regards
gayathri
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
mquser01
PostPosted: Mon Mar 24, 2008 5:06 am    Post subject: Reply with quote

Acolyte

Joined: 06 Mar 2008
Posts: 52

thanks for the prompt reply. please let me know the MQAPI used for receiving messages asynchronously..
does anyone have a sample code used for receiving messages asynchronously or link to any reading material for the same?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Mar 24, 2008 5:09 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The API used to receive an asynchronous message is MQGET.

The API used to receive a synchronous message is MQGET.

Please spend five minutes looking for the Application Programming Guide in the MQ Information Center.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
rtsujimoto
PostPosted: Mon Mar 24, 2008 9:28 am    Post subject: Reply with quote

Centurion

Joined: 16 Jun 2004
Posts: 119
Location: Lake Success, NY

I took a quick look at the MSMQ PMQRECEIVECALLBACK description and there's good news and then there's bad news. The good news is that MQ's asynchronous message retrieval is similar to MSMQ in some respects. The bad news is some of that functionality only exists on z/OS.

As per MS:

When asynchronously reading messages, MQReceiveMessage returns a SUCCESS value if a suitable message is found.

Otherwise, the function returns immediately with the return value MQ_INFORMATION_OPERATION_PENDING. This return value indicates that the operation is pending and will be completed as soon as a suitable message can be found.

Asynchronous receive is based on standard Microsoft® Win32® mechanisms.

To read messages asynchronously, applications can use one of the following:

A callback function
A Windows Event mechanism
A completion port
When using a callback function, you can register only 64 callbacks at the same time.

Completion ports cannot be used by dependent client applications. On MSMQ independent clients and servers, queue handles are implemented as file handles, which allows them to be associated with completion ports. However, on dependent clients, queue handles are not file handles and as a result cannot be used with completion ports.

Keep the output parameters for an asynchronous call to MQReceiveMessage intact until the operation is complete (that is, until you cannot free or reuse them).

Use automatic variables with caution.

In MQ, if a message is available, you will get it immediately, as you would in MSMQ. If none is available, you would get a 2033 return code (e.g. no message available), which could be treated the same as "operation pending". But, the support for asynchronous notification of a suitable message only exists in z/OS, e.g. MQGET with the Signal option. Plus, the program issuing this request must be in assembler.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Mar 24, 2008 9:44 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah.

The .NET Monitor support in MQ v6 will provide this full functionality.

EDIT: I'm feeling nice.
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzav.doc/monitor.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Mar 24, 2008 11:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jefflowrey wrote:
EDIT: I'm feeling nice.


Happy Easter to all our readers
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mquser01
PostPosted: Mon Mar 24, 2008 8:22 pm    Post subject: Reply with quote

Acolyte

Joined: 06 Mar 2008
Posts: 52

as mentioned by rtsujimoto MQGET supports functionality of notification as in MSMQ but this is restricted to z/OS platform and i am working on Linux in C++, so what do i do??
Back to top
View user's profile Send private message
zpat
PostPosted: Mon Mar 24, 2008 11:37 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

I think you are asking, "how can I have a program invoked on arrival of a message rather than waiting for it to arrive"?

Call back processing is very low level, MQ is cross-platform so no surprise that this is not a standard MQI feature.

Triggering is the answer. But don't use this for high volume messaging.
Back to top
View user's profile Send private message
mquser01
PostPosted: Tue Mar 25, 2008 1:18 am    Post subject: Reply with quote

Acolyte

Joined: 06 Mar 2008
Posts: 52

yup you guessed it right i don't want the program to wait for messages to arrive also no of messages i am handling is large in volume.
i want a notification when message arrives so that i can call another function as i can do using callback function in MSMQ i.e. PMQRECEIVECALLBACK ... Is there any way out??? Does MQ provide any support for this functionality --- on Linux in C++??


Last edited by mquser01 on Tue Mar 25, 2008 7:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 25, 2008 1:42 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'm really confused.

You're migrating from MSMQ to C on Linux?

There isn't an equivalent of the .NET Monitor in C. The Java equivalent is an MDB. An MDB just uses a separate thread (in the app server, that you don't have to write) that will sit on MQGET and invoke your own code when a message arrives.

This isn't that hard to write on your own, in C that you can run on Linux.

You can also look at XMS for C/C++.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Mar 25, 2008 1:42 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mquser01 wrote:
i want a notification when message arrives so that i can call another function as i can do using callback function in MSMQ i.e. PMQRECEIVECALLBACK ... Is there any way out??? Does MQ provide any support for this functionality --- on Linux in C++??


Triggering is the only Linux mechanism for notification of message receipt, and you don't want to be triggered on every message if the message volume is large.

It's not a big thing to implement a C++ app that calls your function on the arrival of each message, but IMHO you'll need to implement it yourself via an app.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 25, 2008 2:23 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

jefflowrey wrote:
I'm really confused.

You're migrating from MSMQ to C on Linux?

There isn't an equivalent of the .NET Monitor in C. The Java equivalent is an MDB. An MDB just uses a separate thread (in the app server, that you don't have to write) that will sit on MQGET and invoke your own code when a message arrives.

This isn't that hard to write on your own, in C that you can run on Linux.

You can also look at XMS for C/C++.


Remember to look into the XMS support pack that Jeff mentioned here.
It will allow you to use JMS like functionality in C/C++ and will exactly do what you're looking for...(check for message listener functionality)

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mquser01
PostPosted: Wed Mar 26, 2008 11:03 pm    Post subject: XMS Reply with quote

Acolyte

Joined: 06 Mar 2008
Posts: 52

as suggested i have installed XMS on my machine and was going through the pdf in the installation package.
can any one please give me brief idea on what exactly is XMS and when is it used ?
Also please let me know to understand the concept of XMS where should i start from?? I have never used JMS so i don't know anything about JMS functionality whose refernce is used in the pdf also...
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Mar 27, 2008 1:41 am    Post subject: Re: XMS Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mquser01 wrote:
can any one please give me brief idea on what exactly is XMS and when is it used ?


XMS is a JMS implementation for non-Java applications.

mquser01 wrote:
Also please let me know to understand the concept of XMS where should i start from?? I have never used JMS so i don't know anything about JMS functionality whose refernce is used in the pdf also...


Start from JMS. Any of the reference works on JMS (Mr Google will be happy to help with finding those) will illustrate XMS.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » Asynchronously receive message
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.