|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
how to specify my message to be persistent |
« View previous topic :: View next topic » |
Author |
Message
|
Vishy |
Posted: Mon Oct 20, 2003 12:52 pm Post subject: how to specify my message to be persistent |
|
|
Novice
Joined: 30 Jul 2003 Posts: 21
|
Hi,
My messages are disappearing from MQ. The messages need to be PERSISTANT messages. The messages have been going to the SYSTEM.DEAD.LETTER.QUEUE but have been disgarded by the Dead letter handler because they are non-persistant. Where and how should I set that?
Initially I thought it was with message.expiry and increased it to 900000.
Thanks
Vishy
here is the code
Code: |
public static int sendMessage(String m_msg,String qManager, String mqQName) throws MQException,Exception{
MQQueueManager qMgr = null;
byte[] message_Id = null;
String msgData = null;
MQQueue system_default_local_queue = null;
try{
// Create a connection to QManager
qMgr = new MQQueueManager(qManager);
// Set up the options on the Q we wish to open
int openOptions = MQC.MQOO_OUTPUT;
// Now specify the Q that we wish to open and the open options
system_default_local_queue = qMgr.accessQueue(mqQName, openOptions);
// Define a simple message
MQMessage mqMsg = new MQMessage();
mqMsg.format = MQC.MQFMT_STRING;
mqMsg.priority = MQC.MQPRI_PRIORITY_AS_Q_DEF;
//mqMsg.expiry = 9990000;
mqMsg.writeString(m_msg);
MQPutMessageOptions mqPMO = new MQPutMessageOptions();
// Put the message on the Q
system_default_local_queue.put(mqMsg,mqPMO);
rset2 = stmt1.executeQuery ("UPDATE NXT_PSFT_XML_DOCUMENTS SET PROCESSED_FLAG='Y' WHERE PROCESSED_ID =" +m_processed_id);
java.text.SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd ww 'at' hh:mm:ss a zzz");
java.util.Date day = new java.util.Date();
System.out.println("This record is processed on:" + formatter.format( day ));
message_Id = mqMsg.messageId;
System.out.println("The message Id is" + mqMsg.messageId );
// Close the Queue
system_default_local_queue.close();
// Disconnect from QueueManager
qMgr.disconnect();
return 0;
} catch (MQException ex) {
System.out.println("A WebSphere MQ error occurred : Completion code " + ex.completionCode + " Reason code " + ex.reasonCode);
return 1;
} catch(SQLException sqle) {
System.out.println("Unable to Access the database");
return 2;
} catch(Exception e) {
System.out.println("Exception caught");
return 3;
}
}
|
|
|
Back to top |
|
 |
vennela |
Posted: Mon Oct 20, 2003 1:12 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
You need to set the message persistence field.
mqMsg.persistence = MQC.MQPER_PERSISTENT
Quote: |
Initially I thought it was with message.expiry and increased it to 900000.
|
Your assumtion here is not right. |
|
Back to top |
|
 |
Vishy |
Posted: Mon Oct 20, 2003 3:31 pm Post subject: Thanks |
|
|
Novice
Joined: 30 Jul 2003 Posts: 21
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|