Author |
Message
|
brgmo |
Posted: Sat Nov 29, 2003 10:23 am Post subject: how to retrieve remaining msgs of a group in case appln dies |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
Hi All
I am writing an application in which messages are sent and retrieved in a group. Now, in case i have send 10 messages in a group. Now when i retrieve the message i use ALL_MESSAGES_AVAILABLE option and every time a message is retrieved i call commit. Now suppose after recieveing 6 messages my application dies and when i restart the application and try to retrive the remaining mesages of that particular group, the call executes with the no messages available exception(2033). The messages remain on the queue and can not be retrived. Thesemessages that i am retrieving
are used to construct a file. Now my question is ow to retrieve the remaining messages of the group once the application is restarted. Please help me as this is very urgent and i was struggling to solve this problem for past few days and i am unable to solve it.
Thanks in advance
brgmo. |
|
Back to top |
|
 |
EddieA |
Posted: Sat Nov 29, 2003 11:09 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Don't call commit until you have read and processed ALL the mesages in the group.
Or modify the example, Putting and getting a group that spans units of work, in the Message Segmentation section of Chapter 10, Getting Messages from a Queue in the Application Programming Guide. It uses a 'Status' Queue to hold information about where in the Group you are currently processing.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
brgmo |
Posted: Sat Nov 29, 2003 12:29 pm Post subject: |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
Thanks a lot eddie for replying.But my question here is to how to rerieve the messages of a group which could not be retrived due to application failure.now when the application is up and when i try to retrieve the message,the call ends with no message available reason code even though the messages are available on the queue.my business requirement is such that i have to commit every time a message arrives and populate a file.so can you give me some idea as how to retrieve the remaining messages of a group once the application dies after retrieving some messages.i will be waiting for your resonse.
thanks
brgmo |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Nov 29, 2003 12:56 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You'll have to modify your code. You can't get messages from a partial group when using ALL_MESSAGES_AVAILABLE.
You'll have to do something when your app starts up to determine if there are messages that aren't part of a complete group, and then get the messages without using ALL_MESSAGES_AVAILABLE. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EddieA |
Posted: Sat Nov 29, 2003 9:48 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Based on the reference I posted above:
Code: |
GET under Syncpoint from STATUS Queue
If NO MESSAGE, set option ALL_MESSAGES, no GroupId
else, set MATCH OPTIONS to GroupId and SEQ from message.
Label A.
GET message under Synpoint.
Process Message.
If message was Last-in-Group, then Commit and EXIT.
Build STATUS message using GroupId and SEQ + 1.
PUT STATUS message under Syncpoint.
Commit.
Set options to get Next Logical message.
Loop back to Label A. |
This doesn't consider that there might be more than one Logical Group on the Queue at the same time. I'll leave that to you.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
brgmo |
Posted: Sun Nov 30, 2003 2:18 pm Post subject: |
|
|
Master
Joined: 03 Jun 2002 Posts: 227
|
THANKS A LOT EDDIE.i tried to implement pseudocode sent by you but some how i am not able to understand what is meant by status queue and how to store the status of a particular message on status queue and how to retrieve a missing message's details in a group in case the reply message doesn't come for a particular request message.if you can send me some more elaborative code written in java, it will be really helpful for me or else if you can explain the status queue in greater details as how to use it in case of missing mesages in the group, it will help me in implementing and coding the solution easily.
Thanks,thanks a lot Eddie for all your guidance. |
|
Back to top |
|
 |
|