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 » WebSphere Message Broker (ACE) Support » JCN: Accessing PutDate and PutTime from MQMD

Post new topic  Reply to topic
 JCN: Accessing PutDate and PutTime from MQMD « View previous topic :: View next topic » 
Author Message
ican.sbyn
PostPosted: Tue Jul 14, 2009 4:17 am    Post subject: JCN: Accessing PutDate and PutTime from MQMD Reply with quote

Novice

Joined: 14 Jul 2009
Posts: 19

Hi,
In My project I have a requirement to access PutDate and PutTime from MQMD in a Java Compute node (from the input message)....? How can I access those fields in a JCN?

However , I can access the other MQMD fields in a JCN as below:

MbElement PutApplName1 = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("PutApplName");
PutApplName = PutApplName1.getValue().toString();

But the above procedure will not be good enough to access PutDate and PutTime , as those two fields are MbDate[].
Back to top
View user's profile Send private message
gs
PostPosted: Tue Jul 14, 2009 4:58 am    Post subject: Reply with quote

Master

Joined: 31 May 2007
Posts: 254
Location: Sweden

getValue() will return objects of the MbDate / MbTime type for these fields. Have you taken a look at the methods?
Back to top
View user's profile Send private message
jbanoop
PostPosted: Tue Jul 14, 2009 5:39 am    Post subject: Reply with quote

Chevalier

Joined: 17 Sep 2005
Posts: 401
Location: SC

Try

MbElement putDateElem = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("PutDate");
MbDate putDt = (MbDate) putDateElem.getValue();

Judging by the API , a cast to MbDate should do the trick.
Back to top
View user's profile Send private message Yahoo Messenger
ican.sbyn
PostPosted: Tue Jul 14, 2009 9:51 pm    Post subject: Reply with quote

Novice

Joined: 14 Jul 2009
Posts: 19

Hi,
In the MQMD, the value of PutDate=2009-07-15 and PutTime=05:40:56.240.

If I use the code-
MbElement putDateElem = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("PutDate");
MbDate putDt = (MbDate) putDateElem.getValue();

[ I have tried to convert this into string also!
String PutDate=putDt.toString(); ---But no hope]
, Then I am geting the out put like:


<MQMDFields>
<ReplyToQMgr>WBRK61_DEFAULT_QUEUE_MANAGER</ReplyToQMgr>
<SourceQueue>QL_HTTP_IN</SourceQueue>
<Encoding>546</Encoding>
<PutApplName>admin\Desktop\rfhutil.exe</PutApplName>
<PutDate>com.ibm.broker.plugin.MbDate[time=?,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=2009,MONTH=6,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=15,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?]</PutDate>
<PutTime>com.ibm.broker.plugin.MbTime[time=?,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="GMT",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=0,MONTH=0,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=0,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=0,HOUR=5,HOUR_OF_DAY=5,MINUTE=34,SECOND=35,MILLISECOND=110,ZONE_OFFSET=?,DST_OFFSET=?]</PutTime>
</MQMDFields>

I want my output should look like:
<MQMDFields>
<ReplyToQMgr>WBRK61_DEFAULT_QUEUE_MANAGER</ReplyToQMgr>
<SourceQueue>QL_HTTP_IN</SourceQueue>
<Encoding>546</Encoding>
<PutApplName>admin\Desktop\rfhutil.exe</PutApplName>
<PutDate>2009-07-15</PutDate>
<PutTime>05:40:56.240</PutTime>
</MQMDFields>

( I am able to retrieve the other fileds from MQMD as in the example).
I am missing the appropriate code to extract those date and time fields...
Back to top
View user's profile Send private message
gs
PostPosted: Tue Jul 14, 2009 10:39 pm    Post subject: Reply with quote

Master

Joined: 31 May 2007
Posts: 254
Location: Sweden

Did you take a look at the methods for the MbDate object?

Code:
MbElement putDateElem = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("PutDate");
MbDate putDt = (MbDate) putDateElem.getValue();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-dd-MM");

String dateAsString = sdf.format(putDt.getTime());
Back to top
View user's profile Send private message
ican.sbyn
PostPosted: Wed Jul 15, 2009 12:21 am    Post subject: Reply with quote

Novice

Joined: 14 Jul 2009
Posts: 19

THANKS All. It worked.
Code:
          MbElement pDelem = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("PutDate");
          MbDate pD1 = (MbDate) pDelem.getValue();
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
          String putDate = sdf.format(pD1.getTime());
         
          /*************************************/
          MbElement pTelem = outMessage.getRootElement().getFirstChild().getNextSibling().getFirstElementByPath("PutTime");
          MbTime pT1 = (MbTime) pTelem.getValue();
          SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm:ss.SSS");
          String putTime = sdf1.format(pT1.getTime());
         
          /*************************************/
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 » WebSphere Message Broker (ACE) Support » JCN: Accessing PutDate and PutTime from MQMD
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.