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 » putDateTime returns current time if null

Post new topic  Reply to topic
 putDateTime returns current time if null « View previous topic :: View next topic » 
Author Message
caleb20
PostPosted: Wed Feb 11, 2009 1:50 am    Post subject: putDateTime returns current time if null Reply with quote

Newbie

Joined: 11 Feb 2009
Posts: 3
Location: Geneva, Switzerland

Hi everyone,

I'm developing java software that periodically scans a queue in browse mode to get the depth and the oldest message date. The point is warning users if the queue starts to fill above a max amount of messages, or if a message has been sitting here for too long.

The problem is that for an unknown reason some messages have no timestamp, and in java it appears that a message with blank/null timestamp will return the current date when calling m.putDateTime.

Then I will never know for how long this message has been in the queue.

Is there a way of making the message return null or something instead of current date ?

Who is responsible for assigning the date ? The MQManager ? In which case would it leave a null value ?

Thank you in advance

caleb20
_________________
Bad guys always kill the messenger...
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Feb 11, 2009 2:28 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

You might be able to use the queue statistics feature in MQ V6 instead of doing this the hard way.

Not sure how you access these programmatically.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 11, 2009 2:32 am    Post subject: Re: putDateTime returns current time if null Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

caleb20 wrote:
Who is responsible for assigning the date ? The MQManager ? In which case would it leave a null value ?


The PutDate/Time is assigned by the queue manager once the message is accepted for delivery and cannot, AFAIK, ever be null.

I don't speak Java so can't comment on when or why this method would return a null value.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
caleb20
PostPosted: Wed Feb 11, 2009 3:11 am    Post subject: Reply with quote

Newbie

Joined: 11 Feb 2009
Posts: 3
Location: Geneva, Switzerland

zpat and Vitor,

Sadly I do not have any freedom on technology choices, so I have to use mq-1.4.2.jar libraries to do it, and my boss wants to bypass the IT crew, which has the MQ servers, to make an undercover home made monitoring tool .

As Vitor said, the MQManager should not assign null values for datetime, that's why I'm puzzled by this behaviour, as every message posted in this queue come from the same process and is posted the same way.

For what I guess, the mq implementation creates a brand new 'GregorianCalendar' object - which by default is initialized with system date -, fails somehow to set it with the actual message date, and instead or returning a null value returns the 'GregorianCalendar' object.

I'm going to try to get the date through JMS API instead of MQ, and I'll let you know.

Thank you for your quick responses

Caleb20
_________________
Bad guys always kill the messenger...
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 11, 2009 3:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

caleb20 wrote:
my boss wants to bypass the IT crew, which has the MQ servers, to make an undercover home made monitoring tool .


Nothing like internal politics to increase complexity & TCO.

caleb20 wrote:
that's why I'm puzzled by this behaviour, as every message posted in this queue come from the same process and is posted the same way.


A simple test would be something like amqsbcg to check that each message actually has a put time. I'm 99.99999999999999% certain that this is the case, but for the time it will take it eliminates one cause of error.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
caleb20
PostPosted: Wed Feb 11, 2009 6:46 am    Post subject: Reply with quote

Newbie

Joined: 11 Feb 2009
Posts: 3
Location: Geneva, Switzerland

Dear Vitor and zpat,

I beg your forgiveness...

I found out that somehere in the big spaghetti system, the messages posted on the queue were build MANUALLY. Basically it was creating a new empty MQMessage and setting each field one by one. Of course, the putDateTime was not set at all, hence null values.

Anyway thank you for the 'amqsbcg' command, didn't know it. Here we use 'q' command.

Sorry to have wasted your time, have a nice day.
_________________
Bad guys always kill the messenger...
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 11, 2009 7:04 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

caleb20 wrote:
I found out that somehere in the big spaghetti system, the messages posted on the queue were build MANUALLY. Basically it was creating a new empty MQMessage and setting each field one by one. Of course, the putDateTime was not set at all, hence null values.


Well that's something I didn't know was possible when I woke up this morning! I really must get into Java one day.

caleb20 wrote:
Anyway thank you for the 'amqsbcg' command, didn't know it. Here we use 'q' command.


Pedantically neither are commands; amqsbcg is a piece of source code supplied with the product and optionally installed, and q is a downloadable support pac.

I mention this principally for the benefit of other readers, who might wonder why one or both of these "commands" don't work on their site...
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » putDateTime returns current time if null
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.