Author |
Message
|
chaitu_bca |
Posted: Mon Apr 05, 2004 1:29 am Post subject: accessing the MQMD part of a message using java |
|
|
Novice
Joined: 05 Apr 2004 Posts: 20
|
Iam trying to access the expiration field in the MQMD part of the message using java by using the com package supplied by IBM. Without using JMS is there any method to access the Expiration field. |
|
Back to top |
|
 |
JasonE |
Posted: Mon Apr 05, 2004 1:40 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
I think you want the 'expiry' property ot the MQMessage |
|
Back to top |
|
 |
chaitu_bca |
Posted: Mon Apr 05, 2004 2:22 am Post subject: Yes |
|
|
Novice
Joined: 05 Apr 2004 Posts: 20
|
Yes i want the expiry part of the MQMessage |
|
Back to top |
|
 |
JasonE |
Posted: Mon Apr 05, 2004 3:19 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
I think you misunderstood (or I misunderstood your reply!). You access the MD portion via properties, so eg.
MQMessage myMsg = new MQMessage()
myMsg.expiry = 1000; |
|
Back to top |
|
 |
chaitu_bca |
Posted: Mon Apr 05, 2004 4:42 am Post subject: |
|
|
Novice
Joined: 05 Apr 2004 Posts: 20
|
But how do i retrive the expiration time of a message which has allready been set when the message was put.
For instance
long l = myMsg.expiry;
System.out.println("Expiration time:"+l);
This raises an MQException with Completion Code 1, Reason 2110 |
|
Back to top |
|
 |
JasonE |
Posted: Mon Apr 05, 2004 4:57 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
2110? Can you please expand on your exact sequence of events. For example you can get a message and query its expiry:
Code: |
import com.ibm.mq.*;
public class get {
public static String myQmgr = null;
public static String myQueue = null;
public static void main(String[] args) {
try {
MQQueueManager mqQMgr = new MQQueueManager( args[1] );
MQQueue mqQueue = mqQMgr.accessQueue( args[0], MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING );
MQMessage mqMsg = new MQMessage();
mqQueue.get(mqMsg);
System.out.println("Message info : " + mqMsg.readString(10));
[b] System.out.println("expiry : " + mqMsg.expiry);[/b]
} catch (Exception e) {
System.out.println("Exception : " + e);
}
}
}
|
|
|
Back to top |
|
 |
chaitu_bca |
Posted: Mon Apr 05, 2004 9:05 pm Post subject: It worked |
|
|
Novice
Joined: 05 Apr 2004 Posts: 20
|
Thank you very much jason . I am able to access msg expiry now. The problem actually was in a different place for which i suppose i got the 2110 exception. The data format was not properly set initially so i was not able to access the message.
Thanks for helping me out jason |
|
Back to top |
|
 |
|