Author |
Message
|
URPradhan |
Posted: Thu May 05, 2011 7:52 pm Post subject: Set message properties using MQSETMP in C++ |
|
|
Novice
Joined: 05 May 2011 Posts: 14
|
Hi Friends
I'm new to MQ Series and we are here using MQ Series v7.
I'm writing a C++ MQ client application for z/OS, which needs to send messages with message properties. And after reading the documentation I found that I have to use MQSETMP API to set message properties. But this API is a "C" API, but I want to write a "C++" application.
I did not find any relevant C++ class which will set message properties also no way to use the MQSETMP API in C++. MQSETMP needs connection handle and message handle.
If anyone has written any C++ client application with message properties please help me.
Thank you. |
|
Back to top |
|
 |
shashikanth_in |
Posted: Fri May 06, 2011 3:50 am Post subject: |
|
|
Centurion
Joined: 26 Feb 2009 Posts: 123
|
No, MQSETMP is not available in MQ C++ interface. It's only in C interface. |
|
Back to top |
|
 |
URPradhan |
Posted: Fri May 06, 2011 6:50 am Post subject: |
|
|
Novice
Joined: 05 May 2011 Posts: 14
|
shashikanth_in wrote: |
No, MQSETMP is not available in MQ C++ interface. It's only in C interface. |
Thank you for your reply.
Which means, If we want to set message properties the ONLY way is to develop a "C" application and a C++ application can not set message properties ?
Why IBM claims that their MQ v7 APIs support C++ API and provides C++ classes ? I know they have given C++ classes but those are partial and for basic feature support.
I was finding out a way to use the MQSETMP in C++, but the main problem is to establish a relation between message handle and ImqMessage/ImqQueue Any solution to this ? |
|
Back to top |
|
 |
mvic |
Posted: Fri May 06, 2011 6:57 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
New V7 MQI facilities (MQSUB, Message Handles, properties etc.) were not reflected in the V7 C++ classes. Open an MQ product requirement via your IBM rep if this is important to you.
How much investment do you already have in using MQ via C++ classes?
It is perfectly OK to call MQI calls from C++. It's just like calling any C function from C++.
IMHO and FWIW there is not huge benefit in using MQ C++ classes to wrap MQI handles, except of course if you already have significant use of MQ C++ classes in your application suite from previous projects. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 06, 2011 8:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What mvic is basically saying is that you should wrap the MQI in your own C++ api if you want to use full function of WMQ calls - and not try to mix and match ImqMessage and MQSETMP. So you would use all of the C API calls, including MQSETMP, rather than using ImqQueueManager and etc and then trying to invoke just MQSETMP.
Or raise a requirement. |
|
Back to top |
|
 |
markt |
Posted: Fri May 06, 2011 8:31 am Post subject: |
|
|
 Knight
Joined: 14 May 2002 Posts: 508
|
It's been publicly stated that the C++ imq classes are "functionally stabilised". They continue to be supported but no new function will be added to them.
For C++ applications, you are - as stated above - much better off calling the C MQI directly. |
|
Back to top |
|
 |
URPradhan |
Posted: Fri May 06, 2011 5:41 pm Post subject: |
|
|
Novice
Joined: 05 May 2011 Posts: 14
|
mqjeff wrote: |
What mvic is basically saying is that you should wrap the MQI in your own C++ api if you want to use full function of WMQ calls - and not try to mix and match ImqMessage and MQSETMP. So you would use all of the C API calls, including MQSETMP, rather than using ImqQueueManager and etc and then trying to invoke just MQSETMP.
Or raise a requirement. |
Again thank you all for your reply.
Yes, I know I can call C APIs from C++. But to call the C-API you must need to have the parameters/objects ready required for that C-API (in my case connection handle/message handle). I could managed to get the connection handle via wrapper ImqQueueManager class, but to get the message handle I MUST have to call again MQCRTMH with the same connection handle. After creating the message handle then how to PUT the message of above message handle in ImqQueue::put() ???
So, If I want to write a C++ client application, then essentially I have to wrap all required MQI calls in my own implementation of classes rather than using IBM provided classes. This was my concern, Why they have given a partial C++ class library  |
|
Back to top |
|
 |
mvic |
Posted: Sat May 07, 2011 2:08 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
URPradhan wrote: |
So, If I want to write a C++ client application, then essentially I have to wrap all required MQI calls in my own implementation of classes |
Well, yes and no. There should be no need to "wrap" things? Just "call" things. You would have had to call methods on your C++ classes if they were there. Now you just have to call functions in C instead.
You are not "on your own", there are lots of C sample programs available with your MQ installation. |
|
Back to top |
|
 |
URPradhan |
Posted: Sun May 08, 2011 1:58 am Post subject: |
|
|
Novice
Joined: 05 May 2011 Posts: 14
|
mvic wrote: |
Well, yes and no. There should be no need to "wrap" things? Just "call" things. You would have had to call methods on your C++ classes if they were there. Now you just have to call functions in C instead. |
Exactly. But for this particular case, to call the MQSETMP, I need at least 2 handles. I can get the connection handle from ImqQueueManager or ImqQueue and can create a message handle using MQCRTMH. Upto this its clear.
Now, to put a message I'll use ImqQueue.put(ImqMessage) function. This function needs an object of ImqMessage. If I ll create a new ImqMessage object then how can I assign the relationship between this and the message handle that I have created earlier which has also message properties set. If I'll not assign the relation that the message properties will not be sent instead only the message text will be sent. I'm confused here.
Now, from documentation I learnt that I can use the ImqPutMessageOption object which has a MQPMO structure. But this class missing the OriginalMesageHandle, Action, etc (defined in MQPMO v3). Had the OriginalMessageHandle be there in ImqMessagePutOption class I could have used that in the overloaded ImqQueue.put(ImqMessage, ImqMessageOption) function.
Again, note that I'm very new to MQ. So my query may be awkward to you. Request you to please help me. |
|
Back to top |
|
 |
mvic |
Posted: Sun May 08, 2011 7:46 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
As markt has said, about the MQ C++ classes, "They continue to be supported but no new function will be added to them."
I have already said all I know on this subject, so cannot be of further assistance, sorry.
If writing for a C/C++ environment, and wanting to use the new V7 functions, my suggestion would be to spend a little effort implementing in MQ's C APIs, rather than continue to struggle with the C++ stuff. |
|
Back to top |
|
 |
URPradhan |
Posted: Sun May 08, 2011 10:15 am Post subject: |
|
|
Novice
Joined: 05 May 2011 Posts: 14
|
mvic wrote: |
As markt has said, about the MQ C++ classes, "They continue to be supported but no new function will be added to them."
I have already said all I know on this subject, so cannot be of further assistance, sorry.
If writing for a C/C++ environment, and wanting to use the new V7 functions, my suggestion would be to spend a little effort implementing in MQ's C APIs, rather than continue to struggle with the C++ stuff. |
Thank you very much mvic and thank you for your time. I really appreciate your prompt reply. |
|
Back to top |
|
 |
URPradhan |
Posted: Mon May 09, 2011 2:06 am Post subject: |
|
|
Novice
Joined: 05 May 2011 Posts: 14
|
markt wrote: |
It's been publicly stated that the C++ imq classes are "functionally stabilised". They continue to be supported but no new function will be added to them.
For C++ applications, you are - as stated above - much better off calling the C MQI directly. |
@markt
Can you please give me the link which says "C++ imq classes are functionally stabilized. They continue to be supported but no new function will be added to them" ? |
|
Back to top |
|
 |
|