Question & Answer
Question
Q1. Why do messages get discarded at restart of the queue manager?
Q2. Why do messages survive a restart?
Q3. What is the best way to be certain that messages are persistent?
Q4. If you send a non-persistent message over a fast channel and the channel fails, can you lose your messages?
Answer
However, the queue attribute NPMCLASS(HIGH) can change the treatment of non-persistent messages (see details below).
A2. Persistent messages survive system restarts because they are considered to be essential messages. If the data in a message is important to your business, then you should always make your messages persistent.
A3. The MQ Client application that puts the message into the queue is RESPONSIBLE for determining if a message is persistent or non-persistent.
The application needs to set in the Message Descriptor (MQMD) the message persistence to persistent (MQPER_PERSISTENT), or nonpersistent (MQPER_NOT_PERSISTENT) and your message will always retain that value.
Note: MQPER_PERSISTENCE_AS_Q_DEF is the default setting for the persistence value in the MQMD.
See the persistence values listed below.
.
For more details see:
https://www.ibm.com/support/pages/node/6576289
Can a Non-Persistent message be put into an IBM MQ Queue that has attribute DEFPSIST equals to YES?
Or vice versa:
Can a Persistent message be put into an IBM MQ Queue that has attribute DEFPSIST equals to NO?
Answer: The answer to both questions is: YES
Each queue has an attribute that determines the "default persistence" (DEFPSIST) for new messages that will be stored in the queue.
The attribute is defined at the queue level and it is ONLY A SUGGESTION for the MQ client application that has opened the queue.
The persistence of a message is set by the MQ client application.
Use sample "amqsbcg" to browse the messages:
The values are:
Persistence : 0 => Non-Persistent
Persistence : 1 => Persistent
A4. Yes, you can lose non-persistent messages on a fast channel because they are not logged.
- Persistent messages are logged into disk, which requires additional processing and therefore reduces the performance of your application, so you should use persistent messages for essential data only.
- If the data in a message can be discarded when a queue manager stops or fails, use a non-persistent message.
MQPER_* (Persistence Values)
MQPER_NOT_PERSISTENT |
0
|
X'00000000'
|
MQPER_PERSISTENT |
1
|
X'00000001'
|
MQPER_PERSISTENCE_AS_Q_DEF |
2
|
X'00000002'
|
Diagnostic hints and tips:
https://www.ibm.com/docs/en/ibm-mq/9.4?topic=queues-browsing-sample-program
IBM MQ / 9.4
Browsing queues with the sample program
https://www.ibm.com/docs/en/ibm-mq/9.4?topic=constants-mqper-persistence-values
IBM MQ / 9.4
MQPER_* (Persistence Values)
IBM MQ / 9.4
JMS persistent messages
https://www.ibm.com/support/pages/node/507119
Where's my message? Tool and instructions to use the MQ recovery log to find out what happened to your persistent MQ messages on distributed platforms
Additional information
MQPER_PERSISTENCE_AS_Q_DEF can lead to unexpected results. If there is more than one definition in the queue-name resolution path, the default persistence attribute is taken from first queue definition in the path at the time of the MQPUT or MQPUT1 call. This queue could be an:
- alias queue
- local queue
- local definition of a remote queue
- queue-manager alias
- transmission queue
- cluster queue
Product Synonym
WMQ MQ
Was this topic helpful?
Document Information
Modified date:
29 August 2024
UID
swg21231054