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 » how to get timestamp of putting msg into queue

Post new topic  Reply to topic
 how to get timestamp of putting msg into queue « View previous topic :: View next topic » 
Author Message
henry_chuo1
PostPosted: Tue Dec 15, 2015 6:24 pm    Post subject: how to get timestamp of putting msg into queue Reply with quote

Novice

Joined: 13 Nov 2014
Posts: 11

Hi all,

We have a client server application using MQ as middleware. Given that client clocks are not synced with server, is there any way I can get the timestamp that a msg is put into the queue in terms of central server clock? thanks in advance.

Henry
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Tue Dec 15, 2015 7:38 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

The call that puts a MQ message returns the PutDate/PutTime in the MQMD. This is the system clock time on the server where the qmgr is running. There is no other time available.
_________________
Glenn
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Dec 15, 2015 9:51 pm    Post subject: Reply with quote

Grand High Poobah

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

gbaddeley wrote:
The call that puts a MQ message returns the PutDate/PutTime in the MQMD. This is the system clock time on the server where the qmgr is running. There is no other time available.

Not quite. It is the system clock time on the server the queue manager the message was put to is running.
As you have notices this might not be the queue manager the message is getting consumed on and the clocks might differ across your servers.

Use NTP protocol to sync your clocks across your estate.

Or suffer the clock difference between your servers... Eventually the message could get consumed before it was put (clock difference)...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
henry_chuo1
PostPosted: Tue Dec 15, 2015 11:23 pm    Post subject: Reply with quote

Novice

Joined: 13 Nov 2014
Posts: 11

It looks like JMSTimestamp and JMSExpiration use client PC clock while JMS IBM PutTime use server clock on which queue manager is running.
Then does it means that the message will expire in one minute instead of 3 mins (value I set in setTimeToLive() ) as server clock faster than client by 2 mins? thanks

2015-12-16 15:12:18,517 DEBUG SYS - JMSTimestamp:2015-12-16 15:10:03.539
2015-12-16 15:12:18,517 DEBUG SYS - JMSExpiration:2015-12-16 15:13:03.539
2015-12-16 15:12:18,517 DEBUG SYS - JMS_IBM_PutTime:07121851
2015-12-16 15:12:18,517 DEBUG SYS -
JMSMessage class: jms_text
JMSType: null
JMSDeliveryMode: 1
JMSExpiration: 1450249983539
JMSPriority: 4
JMSMessageID: ID:414d5120465443534430312020202020565bea3520057c2f
JMSTimestamp: 1450249803539
JMSCorrelationID: 005
JMSDestination: queue:///C2P.SESS.E01
JMSReplyTo: null
JMSRedelivered: false
JMSXAppID: WebSphere MQ Client for Java
JMSXDeliveryCount: 1
JMSXUserID: mqcpclt
JMS_IBM_Character_Set: UTF-8
JMS_IBM_Encoding: 273
JMS_IBM_Format: MQSTR
JMS_IBM_MsgType: 8
JMS_IBM_PutApplType: 28
JMS_IBM_PutDate: 20151216
JMS_IBM_PutTime: 07121851
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 16, 2015 5:29 am    Post subject: Reply with quote

Grand High Poobah

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

AFAIK TTL or Time To Live is a duration and not a time stamp. This makes your question irrelevant as the duration would be the same regardless if looked at from the client or the server...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
henry_chuo1
PostPosted: Wed Dec 16, 2015 5:45 pm    Post subject: Reply with quote

Novice

Joined: 13 Nov 2014
Posts: 11

Yes, ttl is a duration, but somehow queue manager should have reference timestamp or it is a just counter which count down to 0 when msg is put into the queue? Thanks.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 16, 2015 8:16 pm    Post subject: Reply with quote

Grand High Poobah

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

henry_chuo1 wrote:
Yes, ttl is a duration, but somehow queue manager should have reference timestamp or it is a just counter which count down to 0 when msg is put into the queue? Thanks.

If you look at the Interface, I believe it is a long. This is a counter counting down to 0 in milliseconds, according to the JMS 1.1 Java EE 7 documentation of the producer.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Dec 17, 2015 6:27 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm confused. What does Time To Live have to do with when the message was put?

If the desire is to have the PUTTIME/PUTDATE be relevant to a central clock, then the queue manager server should be configured to use NTP.

Not sure how this is any more complicated than that?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 17, 2015 9:26 am    Post subject: Reply with quote

Grand High Poobah

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

Depends on whether you look at TTL (Time to live) as a duration or as a timestamp. If it is a timestamp the question would have been relevant.
As it is a duration, the question should be irrelevant unless a timestamp is applied against the current time, source time and duration...

Which means that if received on a server where the clock is early you could expire messages that should still be alive...

Best synch up your servers to a local NTP server, and synch that one up with a nearby atomic clock (Denver, Paris, etc...)
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » how to get timestamp of putting msg into queue
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.