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 IndexIBM MQ Installation/Configuration SupportGet continuously message using MQGET

Post new topicReply to topic
Get continuously message using MQGET View previous topic :: View next topic
Author Message
chetandada
PostPosted: Wed Sep 12, 2018 4:08 am Post subject: Get continuously message using MQGET Reply with quote

Newbie

Joined: 12 Sep 2018
Posts: 7

Hi all ,

Below is the function call to get message

MQGET(Hcon, Hobj, &md, &gmo, sizeof(buffer), l_buffer, &messlen, &CompCode, &Reason);

we are getting only one message and after this no message getting.
there are already more than 100 message in queue.

please help to how to get message continuously by MQGET call or is there any command i need to execute?

Thanks in advance.
Back to top
View user's profile Send private message
exerk
PostPosted: Wed Sep 12, 2018 4:32 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5957

Put it in a loop...

...and I strongly suggest that you either get some training, or read the MQ Application Programming Guide.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.

Back to top
View user's profile Send private message
chetandada
PostPosted: Wed Sep 12, 2018 4:39 am Post subject: Reply with quote

Newbie

Joined: 12 Sep 2018
Posts: 7

It is already written in loop
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Sep 12, 2018 4:50 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

chetandada wrote:
It is already written in loop


So what you're saying is that your code enters the loop, executes the first MQGet call as posted, then loops back, executes the MQGet call again and doesn't return a message?

So what does happen? The call sits endlessly? It returns with a reason code?
Flying monkeys steal your computer? What?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
exerk
PostPosted: Wed Sep 12, 2018 4:54 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5957

chetandada wrote:
It is already written in loop

Then either your logic is flawed, or you are not resetting the MsgId on each GET...

...depending on gmo.Version you're setting (if any).

Take a look at the samples, specifically amqsget0.c, which will help you.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.

Back to top
View user's profile Send private message
chetandada
PostPosted: Wed Sep 12, 2018 5:04 am Post subject: Reply with quote

Newbie

Joined: 12 Sep 2018
Posts: 7

Vitor wrote:
chetandada wrote:
It is already written in loop


So what you're saying is that your code enters the loop, executes the first MQGet call as posted, then loops back, executes the MQGet call again and doesn't return a message?

So what does happen? The call sits endlessly? It returns with a reason code?
Flying monkeys steal your computer? What?


yes it doesn't return a message after next call of MQGET
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Sep 12, 2018 5:47 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

chetandada wrote:
yes it doesn't return a message after next call of MQGET


If the call sits endlessly and doesn't return then it's not finding a suitable message.

My worthy associate points out the typically noob mistake in these circumstances, and I echo all the advice he gives.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
exerk
PostPosted: Wed Sep 12, 2018 5:51 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5957

Vitor wrote:
...My worthy associate points out the typically noob mistake in these circumstances, and I echo all the advice he gives.

I am in very great danger of actually knowing what I'm talking about for once - a scary thought! Probably been hanging around developers for far longer than is good for me .
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.

Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Wed Sep 12, 2018 10:36 am Post subject: Re: Get continuously message using MQGET Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3082
Location: London, ON Canada

chetandada wrote:
MQGET(Hcon, Hobj, &md, &gmo, sizeof(buffer), l_buffer, &messlen, &CompCode, &Reason);

A couple of things:
(1) Why are you using "sizeof(buffer)" but the real buffer "l_buffer" has a different name. That's some bad programming.
(2) Are you clearing the MsgId and CorrelId before each MQGET call?
i.e.
Code:
memcpy(md.MsgId, MQMI_NONE, sizeof(md.MsgId));
memcpy(md.CorrelId, MQCI_NONE, sizeof(md.CorrelId));


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
hughson
PostPosted: Wed Sep 12, 2018 2:28 pm Post subject: Re: Get continuously message using MQGET Reply with quote

Sentinel

Joined: 09 May 2013
Posts: 840
Location: Bay of Plenty, New Zealand

RogerLacroix wrote:
chetandada wrote:
MQGET(Hcon, Hobj, &md, &gmo, sizeof(buffer), l_buffer, &messlen, &CompCode, &Reason);

Are you clearing the MsgId and CorrelId before each MQGET call?
i.e.
Code:
memcpy(md.MsgId, MQMI_NONE, sizeof(md.MsgId));
memcpy(md.CorrelId, MQCI_NONE, sizeof(md.CorrelId));


_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
chetandada
PostPosted: Thu Sep 13, 2018 11:26 pm Post subject: Re: Get continuously message using MQGET Reply with quote

Newbie

Joined: 12 Sep 2018
Posts: 7

Code works fine after resetting msgid on each MQGET call..

Thank you all
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sat Sep 15, 2018 6:19 am Post subject: Re: Get continuously message using MQGET Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8191
Location: US: west coast, almost. Otherwise, enroute.

chetandada wrote:
Code works fine after resetting msgid on each MQGET call..

Thank you all

The documented behavior of MQGET is to retrieve the MQMD (and message payload). On the next MQGET call, if the MQMD MsgId, CorrelId, GroupID, etc. are NOT reset, then the call is asking for another message with these exact same values - not impossible, but highly unlikely.
_________________
I would tell you a UDP joke, but you might not get it.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Sep 19, 2018 2:59 pm Post subject: Re: Get continuously message using MQGET Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1315

This topic seems better suited for the IBM MQ API Support forum.

chetandada wrote:
Code works fine after resetting msgid on each MQGET call.

That is one way to disable selectively matching messages, especially useful for any applications that still need to maintain backwards compatibility with MQSeries queue managers.

exerk wrote:
Take a look at the samples, specifically amqsget0.c, which will help you.

Otherwise, applications can set MQGMO Version to MQGMO_VERSION_2 (or greater), and MatchOptions to MQMO_NONE, so as to avoid the need to reset MsgId and CorrelId before each MQGET call.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ Installation/Configuration SupportGet continuously message using MQGET
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.