Author |
Message
|
ohkats |
Posted: Sat Nov 29, 2003 12:21 am Post subject: putDateTime |
|
|
Newbie
Joined: 29 Nov 2003 Posts: 2
|
Hi,
A Put a msg in a Q, & read the PutTime, it shows properly.
Next I save the MsgId, create a new Msg var (as below) &
try to read PutTime (of same msg) , it gives NullPointerEx.. why ?
I am able to read the Msg below however.. (note I am creating
a completely new connection again to same Q & then reading
in another func as below...)
MQMessage mGet= new MQMessage();
mGet.messageId = lMsgId; // My saved MsgId
qTime = mGet.putDateTime.getTime();
System.out.println("The putTime was: " + qTime);
Regards,
KS |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Dec 03, 2003 12:03 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I believe you are getting the exception because you are trying to read a field in a message that has never been put. Without looking at the spec, I can't say if this is the specified behavior or not. |
|
Back to top |
|
 |
vids |
Posted: Thu Dec 04, 2003 3:09 pm Post subject: |
|
|
 Acolyte
Joined: 24 Mar 2003 Posts: 68 Location: CA, USA
|
MQMessage mGet= new MQMessage(); -->>> Here you are creating a MQMessage object
mGet.messageId = lMsgId; // My saved MsgId -->> Here you are setting the old message id to new message object
-->> Here you pull or put the message from/to the queue
Now try to capture the putDataTime as below
qTime = mGet.putDateTime.getTime();
System.out.println("The putTime was: " + qTime); _________________ Vids |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Dec 05, 2003 6:18 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I think I'm confused:
Quote: |
mGet.messageId = lMsgId; // My saved MsgId -->> Here you are setting the old message id to new message object
|
I thought this was saving the message id from the old message into the message id of the new message? What makes you think that it is saving the whole message (ie, the puttime)? |
|
Back to top |
|
 |
ohkats |
Posted: Sun Dec 07, 2003 9:11 pm Post subject: |
|
|
Newbie
Joined: 29 Nov 2003 Posts: 2
|
bower5932 wrote: |
Quote: |
mGet.messageId = lMsgId; // My saved MsgId -->> Here you are setting the old message id to new message object
|
I thought this was saving the message id from the old message into the message id of the new message? What makes you think that it is saving the whole message (ie, the puttime)? |
... I thought this is how U access an existing message in a Q if U knew its MsgID .. sort of like a pointer to an existing msg in a Q... |
|
Back to top |
|
 |
bower5932 |
Posted: Mon Dec 08, 2003 8:09 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
A MsgId is just one property of a message. It isn't the entire message. You can use the Msgid to access a message on a queue. You can do a get by MsgId to get a particular message. However, it looks like you are trying to make a copy of the message and not try the get. |
|
Back to top |
|
 |
vids |
Posted: Mon Dec 08, 2003 11:07 am Post subject: |
|
|
 Acolyte
Joined: 24 Mar 2003 Posts: 68 Location: CA, USA
|
guys,
mGet.messageId = lMsgId; // My saved MsgId -->> Here you are setting the old message id to new message object
Here what I mean is you are setting the old message id to the message id of the new message object.(Sorry my statement was not very clear)
Now once you set your saved MsgId to the messageId of the new message, try to give
get call.
Whate it does is, it pulls only the message which matches the messageid.
after pulling the message you can find putDateTime as below
qTime = mGet.putDateTime.getTime();
Which shows at what time this message was put to the queue by putting application and it will be in GMT format. _________________ Vids |
|
Back to top |
|
 |
kman |
Posted: Thu Dec 11, 2003 12:15 am Post subject: |
|
|
Partisan
Joined: 21 Jan 2003 Posts: 309 Location: Kuala Lumpur, Malaysia
|
mGet is a new message object.
Puttime is the time when you put the message.
If you are trying to get the put time on mGet, there is none. You haven't put the message yet, how can you get the time?
If you want to get the puttime of the message on the queue, then it is possible. |
|
Back to top |
|
 |
|