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 » General IBM MQ Support » persistent / not-persistent messages in c# .Net

Post new topic  Reply to topic
 persistent / not-persistent messages in c# .Net « View previous topic :: View next topic » 
Author Message
dunesand
PostPosted: Fri Jan 14, 2005 1:46 am    Post subject: persistent / not-persistent messages in c# .Net Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

Hi all,

I've written an application that puts and gets messages on numerous MQ queues using c# (MQ 5.3 CSD05).

The other morning my client lost a whole load of messages and the MQ guys have said they're changing some config on the queues.
Is there anything I may be doing to set the messages as non-persistent?
From what I can tell, the message takes on the property of the queue on which it is placed?
Is there anyway to override this so that all messages are persistent?
Is this advisable?

Thanks for your help. (again!)

Here's the code I use to create and send messages with (removed error handling to make snippet more concise):
Code:

   //
   // create QM object

   queueManager = new MQQueueManager( queueManagerName );


   //
   // create the queue

   MQQueue queue = null;
    queue = queueManager.AccessQueue( queueName,
               MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING );

   MQMessage mqMsg = new MQMessage();


   //
   // Send the message

   mqMsg.WriteString( data );
   mqMsg.Format = MQC.MQFMT_STRING;
   queue.Put( mqMsg );

Back to top
View user's profile Send private message Send e-mail Visit poster's website
zpat
PostPosted: Fri Jan 14, 2005 2:25 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Set the MQMD value for message persistence to PERSISTENT.

If this field is defaulted, it takes the queue default persistence value.

Don't forget if using ALIAS queues (a good idea) that then the default persistence attribute is taken from the alias definition.

This can be used as a way to make some messages persistent and other not (even when all programs are defaulting the persistence), by referencing different queue aliases.

However if you can change the program code and are certain that you always will want persistent messages, setting the MQMD as such is fine.
Back to top
View user's profile Send private message
dunesand
PostPosted: Fri Jan 14, 2005 2:35 am    Post subject: Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

unfortunately that's the catch, I'm not sure how to do this with the .Net interface I'm using.

Thanks for your reply.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dunesand
PostPosted: Fri Jan 14, 2005 3:19 am    Post subject: Reply with quote

Acolyte

Joined: 17 Nov 2003
Posts: 65
Location: Cambridgeshire, UK

found it...

Code:

   //
   // Send the message

   MQMessage mqMsg = new MQMessage();

   mqMsg.WriteString( data );
   mqMsg.Format = MQC.MQFMT_STRING;
   mqMsg.Persistence = MQC.MQPER_PERSISTENT;

   queue.Put( mqMsg );

Back to top
View user's profile Send private message Send e-mail Visit poster's website
PeterPotkay
PostPosted: Fri Jan 14, 2005 2:12 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Persitent message are a drag on performance. You asked if you should make all you messages persistent. No. Only the ones that need to be, i.e. they need to survive a QM restart.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
any2xml
PostPosted: Mon Feb 21, 2005 8:22 pm    Post subject: Reply with quote

Apprentice

Joined: 18 May 2004
Posts: 42

PeterPotkay wrote:
Persitent message are a drag on performance. You asked if you should make all you messages persistent. No. Only the ones that need to be, i.e. they need to survive a QM restart.


I have turned on DefaultPersist (DEFPSIST in Linux) to YES in my XMITQ and receive queues so it survives a restart. It works fine. But do I also have to turn it on for the remote queue? Are there situations where the remote queue may have some messages waiting to go? It is important that all messages through my sender and receive channels persist.
_________________
A Perl Hacker
http://www.goreliance.com
http://www.any2xml.com
Back to top
View user's profile Send private message
EddieA
PostPosted: Mon Feb 21, 2005 11:15 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
I have turned on DefaultPersist (DEFPSIST in Linux) to YES in my XMITQ and receive queues so it survives a restart

That isn't how it works. Persistence is an attribute of a message which is set when the message is PUT. From that point on, the message has the same persistence, no matter what the attribute of the queues it lands on in it's journey.

Take a look at this: http://www.mqseries.net/phpBB2/viewtopic.php?t=20329&highlight=, where persistence is discussed.

Quote:
Are there situations where the remote queue may have some messages waiting to go

I'm not sure what you mean by this. A remote queue is nothing but a definition that names the eventual Q/QM where a message is destined, and the XMITQ where it should be placed to start it's journey. (OK, it can be used for aliasing as well, but that isn't what's asked here. )
Quote:
It is important that all messages through my sender and receive channels persist

Only you, or the system designer, can answer that one.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
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 » General IBM MQ Support » persistent / not-persistent messages in c# .Net
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.