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 » JMSTimestamp header value not set in GMT

Post new topic  Reply to topic
 JMSTimestamp header value not set in GMT « View previous topic :: View next topic » 
Author Message
parikh.vikas
PostPosted: Tue Jan 18, 2011 12:23 pm    Post subject: JMSTimestamp header value not set in GMT Reply with quote

Newbie

Joined: 18 Jan 2011
Posts: 6

Hello friends,

I have been using JMS for almost 2 years, though started working with IBM MQ as JMS provider just few months ago.

MQ version I am using is: IBM MQ v7.0.1
Currently issue I am facing is that, when I send a message to the queue, the value genrated for
Code:
JMSTimestamp
header is not in GMT.
Note that, I am not setting this header explicitly, it automatically gets generated.

From the documentation of javax.jms.Message.getJMSTimestamp() , I see that -
Quote:
When a message is sent, JMSTimestamp is ignored. When the send or publish method returns, it contains a time value somewhere in the interval between the call and the return. The value is in the format of a normal millis time value in the Java programming language.


I understand that it is from 1970, but what will be its timezone?

I will explain my scenario ->
MQ server is in UK(GMT +0)
Publishing server (which publishes messages on queue) is in INDIA(GMT +5:30)
Receving server (which receives messages from queue) is in US (GMT -6)

After publishing message, when i check the message received from receiving server, it comes with JMSTimestamp header value as time in milli seconds from 1970 but in IST, not GMT
(I noted down current time in millis while publishing in IST & found on reciver the same)

Is timezone of
Code:
JMSTimestamp
is that of MQ server or that of publisher ??

I was under impression that it should be GMT, so that it would be standard time.

Am I missing some where or some configuration is required to achieve this?

I require this in GMT, as I want to filter messages on receiver side based on
Code:
JMSTimestamp
in my message selector.
I should select only those messages which are published 1 minute prior to creating consumer.

As publisher / receiver can be anywhere, I want to standardize time in GMT.

Any advice would of great help

Thanks in advance.

Vikas
Back to top
View user's profile Send private message
bsiggers
PostPosted: Tue Jan 18, 2011 12:47 pm    Post subject: Epoch time Reply with quote

Acolyte

Joined: 09 Dec 2010
Posts: 53
Location: Vancouver, BC

If I recall correctly, this number represents a normal unix-style epoch date, as described below, so it's basically in UTC. If you convert to a timezone (as java generally does) it will probably convert it to your local timezone.

http://en.wikipedia.org/wiki/Unix_time

Reading through the rest of your idea about filtering on JMStimestamp in your message selector, I am wondering how well this is going to work - you may want to look at alternate approaches, as my gut instinct is telling me that this solution is not going to do what you want it to do.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 18, 2011 3:40 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You have to differentiate in java between a timestamp or date represented as a long (always UTC) and the text rendered by your program...
You might want to associate the parser and the timezone...
Check out the SimpleDateFormat and the TimeZone classes...
Look up a java tutorial on displaying dates and timestamps...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
parikh.vikas
PostPosted: Wed Jan 19, 2011 11:49 am    Post subject: Reply with quote

Newbie

Joined: 18 Jan 2011
Posts: 6

Yeah, Thanks a lot.

Infact I turned out to be fullish when I say time in millis with different Timezone, as its always UTC

I tried the concept of filtering messages based on JMSTimestamp, with the help of following Message Selector

Code:
JMSTimestamp < (System.currentTimeMillis() - (60 * 1000))


The above message selector returns all messages which are published 1 minute (60 seconds) prior to creating consumer.

This has avoided any worry about time zone, whether publisher is in IST / reciver is in CST.

Thanks guys, great help.

Though I have another question on JMSTimestamp.
In the above scenario, I can not tolerate missing JMSTimestamp header in a message otherwise messages with missing JMSTimestamp header will not be retrieved by above message selector.

Have created another topic, please check this @
http://www.mqseries.net/phpBB2/viewtopic.php?p=295153

It would be great if you comment on that.

Vikas
Back to top
View user's profile Send private message
bsiggers
PostPosted: Wed Jan 19, 2011 12:09 pm    Post subject: System time drift Reply with quote

Acolyte

Joined: 09 Dec 2010
Posts: 53
Location: Vancouver, BC

One more comment regarding differences between timestamps - be aware that it is unfortunately relatively common for systems to drift further apart in time than one minute, especially when systems are geographically seperated - even if ntpd is used.

The problem is in most shops that there is no reason for systems to be synced up all the time so closely in time, so in many UNIX shops this wouldn't even be considered an issue if ntpd goes down and time synchronization drifts off. You may want to set expectations with your system administrators about this requirement that you have to avoid bad surprises.

Hope this helps!
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 » JMSTimestamp header value not set in GMT
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.