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 Java / JMS » accessing the MQMD part of a message using java

Post new topic  Reply to topic
 accessing the MQMD part of a message using java « View previous topic :: View next topic » 
Author Message
chaitu_bca
PostPosted: Mon Apr 05, 2004 1:29 am    Post subject: accessing the MQMD part of a message using java Reply with quote

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
View user's profile Send private message
JasonE
PostPosted: Mon Apr 05, 2004 1:40 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

I think you want the 'expiry' property ot the MQMessage
Back to top
View user's profile Send private message
chaitu_bca
PostPosted: Mon Apr 05, 2004 2:22 am    Post subject: Yes Reply with quote

Novice

Joined: 05 Apr 2004
Posts: 20

Yes i want the expiry part of the MQMessage
Back to top
View user's profile Send private message
JasonE
PostPosted: Mon Apr 05, 2004 3:19 am    Post subject: Reply with quote

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
View user's profile Send private message
chaitu_bca
PostPosted: Mon Apr 05, 2004 4:42 am    Post subject: Reply with quote

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
View user's profile Send private message
JasonE
PostPosted: Mon Apr 05, 2004 4:57 am    Post subject: Reply with quote

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
View user's profile Send private message
chaitu_bca
PostPosted: Mon Apr 05, 2004 9:05 pm    Post subject: It worked Reply with quote

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
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 Java / JMS » accessing the MQMD part of a message using java
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.