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 » WebSphere Message Broker (ACE) Support » determine last record in the Queue based on input message

Post new topic  Reply to topic Goto page 1, 2  Next
 determine last record in the Queue based on input message « View previous topic :: View next topic » 
Author Message
rampriya
PostPosted: Tue Dec 03, 2013 2:57 pm    Post subject: determine last record in the Queue based on input message Reply with quote

Newbie

Joined: 27 Jul 2009
Posts: 9

Hi,

I have a problem determining the last record based on the input message from the Queue.

I have 90000 records in a queue and I am reading messages from queue one by one. I have to group the messages based on the input message and determine the last message in message based in the same.

for example

I have 285 records for one group of message and next group might be 100 and so on...

I need to set the 285th record as last record in the group based on input message.

What I am currently doing I am using few shared variables to do that. But happen is it is setting the next group first record as last message in the group

Following would be the code I am trying to identify last message in the group.
Code:

      IF (tmpMake IS NULL OR tmpMake = '')  THEN
         SET tmpMake = inRef.makeID;
         SET envVar.tmp.Make = tmpMake;
      ELSE
         IF tmpMake <> inRef.makeID THEN
            SET tmpMake = inRef.makeID;
            SET envVar.tmp.Make = tmpMake;
            SET envVar.tmp.Flag = 'TRUE';
            SET envVar.usr.v2econfig.lastMsgFlag = 'YES';
            SET genCnt = 1;
         ELSE
            BEGIN ATOMIC
               SET genCnt = genCnt + 1;
            END;
            SET envVar.usr.v2econfig.lastMsgFlag = 'NO';
         END IF;
         
      END IF;


Please kindly help me to resolve this problem ASAP.

Thanks,
Ramanujan
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 04, 2013 5:41 am    Post subject: Re: determine last record in the Queue based on input messag Reply with quote

Grand High Poobah

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

rampriya wrote:
Please kindly help me to resolve this problem ASAP.


Why isn't the putting application grouping the messages via the WMQ grouping facility which WMB can recognize and honour?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Wed Dec 04, 2013 5:44 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 364
Location: Columbus, OH

So how can you mark the last record in a group as the last record if you don't know it is the last record until you read the next record?
Back to top
View user's profile Send private message
rampriya
PostPosted: Wed Dec 04, 2013 6:50 am    Post subject: Re: determine last record in the Queue based on input messag Reply with quote

Newbie

Joined: 27 Jul 2009
Posts: 9

Vitor wrote:
rampriya wrote:
Please kindly help me to resolve this problem ASAP.


Why isn't the putting application grouping the messages via the WMQ grouping facility which WMB can recognize and honour?



Do You have any other suggestion to group the messages
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 04, 2013 7:05 am    Post subject: Re: determine last record in the Queue based on input messag Reply with quote

Grand High Poobah

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

rampriya wrote:
Vitor wrote:
rampriya wrote:
Please kindly help me to resolve this problem ASAP.


Why isn't the putting application grouping the messages via the WMQ grouping facility which WMB can recognize and honour?



Do You have any other suggestion to group the messages


Not really, because that's the best idea.

You can use some code along the lines you outline (shared variables, databases, etc) all of which have their pros and cons.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rampriya
PostPosted: Wed Dec 04, 2013 7:19 am    Post subject: Re: determine last record in the Queue based on input messag Reply with quote

Newbie

Joined: 27 Jul 2009
Posts: 9

Vitor wrote:
rampriya wrote:
Vitor wrote:
rampriya wrote:
Please kindly help me to resolve this problem ASAP.


Why isn't the putting application grouping the messages via the WMQ grouping facility which WMB can recognize and honour?



Do You have any other suggestion to group the messages


Not really, because that's the best idea.

You can use some code along the lines you outline (shared variables, databases, etc) all of which have their pros and cons.


I am using WMQ Grouping facility, but I have to identify the last message based application value only.
Code:

      SET OutputRoot.MQMD.MsgSeqNumber = ptCnt;
      IF (genCnt = ptCnt AND FIELDVALUE(envVar.usr.v2econfig.lastMsgFlag) = 'YES') THEN
         SET OutputRoot.MQRFH2.usr.v2econfig.lastMsgFlag = FIELDVALUE(envVar.usr.v2econfig.lastMsgFlag);
         SET OutputRoot.MQMD.MsgFlags = MQMF_MSG_IN_GROUP + MQMF_LAST_MSG_IN_GROUP;
      ELSE
         SET OutputRoot.MQRFH2.usr.v2econfig.lastMsgFlag = 'NO';
         SET OutputRoot.MQMD.MsgFlags = MQMF_MSG_IN_GROUP;
      END IF;   


Still I need to identify the last message based on the application message only. That is the problem i am facing, as I am unable to identify the last message.

As per my code first message of the next logical group becomes last message.

Thanks,
Ram[/code]
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 04, 2013 7:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You could use the collector for this.

When the first message in a new collection appears, send a message to a terminal to close the previous collection, and then send the input message to start a new collection.
Back to top
View user's profile Send private message
Simbu
PostPosted: Wed Dec 04, 2013 8:14 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

mqjeff wrote:
You could use the collector for this.

When the first message in a new collection appears, send a message to a terminal to close the previous collection, and then send the input message to start a new collection.


Looks like he is looking for dynamic message collection as well...

rampriya wrote:
I have 285 records for one group of message and next group might be 100 and so on...


but the collector node supports only static message collection(either count of messages or based on time). plz correct me if i'm wrong.


Last edited by Simbu on Wed Dec 04, 2013 8:30 am; edited 1 time in total
Back to top
View user's profile Send private message
rampriya
PostPosted: Wed Dec 04, 2013 8:19 am    Post subject: Reply with quote

Newbie

Joined: 27 Jul 2009
Posts: 9

Simbu wrote:
mqjeff wrote:
You could use the collector for this.

When the first message in a new collection appears, send a message to a terminal to close the previous collection, and then send the input message to start a new collection.


Looks like she is looking for dynamic message collection as well...

rampriya wrote:
I have 285 records for one group of message and next group might be 100 and so on...


but the collector node supports only static message collection(either count of messages or based on time). plz correct me if i'm wrong.



Hi I am not "she" "he"

Yes you are correct I am looking for dynamic message collection
Back to top
View user's profile Send private message
Simbu
PostPosted: Wed Dec 04, 2013 8:31 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

rampriya wrote:
Simbu wrote:
mqjeff wrote:
You could use the collector for this.

When the first message in a new collection appears, send a message to a terminal to close the previous collection, and then send the input message to start a new collection.


Looks like she is looking for dynamic message collection as well...

rampriya wrote:
I have 285 records for one group of message and next group might be 100 and so on...


but the collector node supports only static message collection(either count of messages or based on time). plz correct me if i'm wrong.



Hi I am not "she" "he"

Yes you are correct I am looking for dynamic message collection


sorry boss...editted the post...

These two below links might help you..

http://www.ibm.com/developerworks/websphere/library/techarticles/1304_marie/1304_marie.html

http://www.ibm.com/developerworks/websphere/library/techarticles/1306_chakraborty/1306_chakraborty.html
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 04, 2013 8:36 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So the basic function of Collector does support this. You have two collector input terminals, one that accepts any number of messages, and one that accepts one message.

The collection is only complete when the second terminal accepts it's one message.
Back to top
View user's profile Send private message
rampriya
PostPosted: Wed Dec 04, 2013 8:42 am    Post subject: Reply with quote

Newbie

Joined: 27 Jul 2009
Posts: 9

mqjeff wrote:
So the basic function of Collector does support this. You have two collector input terminals, one that accepts any number of messages, and one that accepts one message.

The collection is only complete when the second terminal accepts it's one message.


Do you have any sample how to achieve this using collector node. If you can share that would be really helpful for me.

Thanks in advance.

Ramanujan
Back to top
View user's profile Send private message
Simbu
PostPosted: Wed Dec 04, 2013 8:52 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

mqjeff wrote:
So the basic function of Collector does support this. You have two collector input terminals, one that accepts any number of messages, and one that accepts one message.

The collection is only complete when the second terminal accepts it's one message.


Quantity property of Collector node says
Quote:
This property specifies the number of messages that the input terminal accepts to add to a message collection.

The default value is 1; if you accept this default value, only one message is added to a collection. If a second message is received on the terminal, a new collection instance is created for it. If you select 0 (zero) or do not specify a value, there is no limit to the number of messages accepted. In this case, the value that is set on the Timeout property must be greater than zero.


And so the collection is depend on the time out property if we choose to accept infinite messages to the terminal.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 04, 2013 9:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Simbu wrote:
mqjeff wrote:
So the basic function of Collector does support this. You have two collector input terminals, one that accepts any number of messages, and one that accepts one message.

The collection is only complete when the second terminal accepts it's one message.


Quantity property of Collector node says
Quote:
This property specifies the number of messages that the input terminal accepts to add to a message collection.

The default value is 1; if you accept this default value, only one message is added to a collection. If a second message is received on the terminal, a new collection instance is created for it. If you select 0 (zero) or do not specify a value, there is no limit to the number of messages accepted. In this case, the value that is set on the Timeout property must be greater than zero.


And so the collection is depend on the time out property if we choose to accept infinite messages to the terminal.


That's why you have two terminals.

One that accepts an unlimited messages, and one that accepts one message.

When the first message in a new group comes in, send an empty message to close the previous collection, then send the first message in the new group to start the new collection.
Back to top
View user's profile Send private message
christopher j
PostPosted: Thu Dec 05, 2013 2:43 am    Post subject: Reply with quote

Novice

Joined: 01 Jan 2010
Posts: 20

Read the messages one by one and store it in a shared variable untill you read the 'Last Record Indicator' message.


Once you received the 'Last Record Indicator' message, propagate the shared variable data(if u want to send the group data as a separate message) or store it in a separate variable and start a next collection by using the 'Last Record Indicator' message as a first record.
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 » WebSphere Message Broker (ACE) Support » determine last record in the Queue based on input 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.