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 » Reading Message without deleting

Post new topic  Reply to topic
 Reading Message without deleting « View previous topic :: View next topic » 
Author Message
koumides
PostPosted: Wed Aug 11, 2010 11:04 am    Post subject: Reading Message without deleting Reply with quote

Newbie

Joined: 11 Aug 2010
Posts: 2

All,

I have a server application which listens to messages from MQ Queue.
At the moment I am reading messages, processing them and writing the results in the database. The problem I have is I don't want to delete them from the queue as soon as I read read them but instead I prefer to delete the message as soon as confirm it has been succesfully written in the database.

Any ideas?
I am using .NET API (C#) running on Windows 2003 server.

Thanks,
MK
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 11, 2010 11:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/advanced/content.jsp?topic=/com.ibm.mq.csqzal.doc/fg13740_.htm
Back to top
View user's profile Send private message
koumides
PostPosted: Wed Aug 11, 2010 1:34 pm    Post subject: Not sure Reply with quote

Newbie

Joined: 11 Aug 2010
Posts: 2

I am not sure I have understood the previous reply.
Can someone please explain it a bit more?
Back to top
View user's profile Send private message
mvic
PostPosted: Wed Aug 11, 2010 2:16 pm    Post subject: Re: Reading Message without deleting Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

koumides wrote:
I don't want to delete them from the queue as soon as I read read them but instead I prefer to delete the message as soon as confirm it has been succesfully written in the database.

Why are you checking the database - is it because the messages are important and must not be lost?

You should instead be using units of work. Preferably global units of work managed by Transaction Manager software that knows how to coordinate updates to MQ and the database under a single unit of work.

In answer to your original question, the thing to search for is browse. If you "browse" a message it is not removed from the queue.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Aug 11, 2010 2:50 pm    Post subject: Re: Not sure Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

koumides wrote:
I am not sure I have understood the previous reply.
Can someone please explain it a bit more?


I have pointed you to the section on creating and using units of work within a Windows environment.

This will tell you how to configure your system so that you can ensure that if the database transaction fails, the mq transaction will be rolled back and vice versa.

You want to solve this problem using units of work, particularly global units of work. You do not want to solve this problem using browse, because you will have to write a large amount of code to ensure that you only destructively read the message after you have ensured the success of the database transaction.

This code would be duplicating all of the code that has helpfully been written and extensively tested for you that comes with MQ and windows to coordinate global units of work.

Read the section of the documentation I have pointed you at. Read it's subsections. Then find the section in the InfoCenter on using .NET code and find where it talks about using Commit() and Rollback() and other unit of work considerations.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Reading Message without deleting
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.