Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting different timestamps for PUT message with pmo.Options as ibmmq.MQPMO_SET_ALL_CONTEXT and ibmmq.MQPMO_SET_IDENTITY_CONTEXT #219

Open
ssuryava-tibco opened this issue Jan 31, 2025 · 3 comments

Comments

@ssuryava-tibco
Copy link

Hi @ibmmqmet ,

For pmo.Options as ibmmq.MQPMO_SET_ALL_CONTEXT, when I put a message through my app, it's showing no values for put date/time on MQ explorer.
However the message put date/time is correct with MQPMO_DEFAULT_CONTEXT and MQPMO_SET_ALL_CONTEXT.
So I tried with putMqmd.PutDateTime = time.Now()
This is giving different timestamps for context ALL as compared to Default and Identity.
Like if it's showing a timestamp for Default and Identity context, it's showing timestamp + 5hrs for all context

Could you please suggest.

Thanks,
Sneha

@ibmmqmet
Copy link
Collaborator

ibmmqmet commented Feb 3, 2025

I assume you are in a +5 timezone. The fields in the MQMD are considered to always be in UTC/GMT. Some tools convert to local time when displaying them, and some do not.

@ssuryava-tibco
Copy link
Author

ssuryava-tibco commented Feb 3, 2025

Hi @ibmmqmet ,

I am in the IST time zone and setting putMqmd.PutDateTime = time.Now().UTC().
I have observed the following:

  1. Context ALL works: The timestamp is correct in MQ Explorer when using MQPMO_SET_ALL_CONTEXT.
  2. 7-second delay with ALL context: There's a 7-second delay in messages with MQPMO_SET_ALL_CONTEXT compared to
    MQPMO_DEFAULT_CONTEXT and MQPMO_SET_IDENTITY_CONTEXT.
  3. Discrepancy between log and MQ Explorer: The timestamp I printed in the logs differs from what MQ Explorer shows for
    MQPMO_DEFAULT_CONTEXT and MQPMO_SET_IDENTITY_CONTEXT.
    When I set MQMD property with 2025-02-03 11:31:07.8324988 +0000 UTC, after queue.Put(putMqmd, pmo, buffer) it's
    showing 2025-02-03 11:31:00.81 +0000 UTC
  4. PutDateTime seems unaffected for Default/Identity: It appears that putMqmd.PutDateTime = time.Now().UTC() has no effect
    on the MQMD PutDateTime for MQPMO_DEFAULT_CONTEXT and MQPMO_SET_IDENTITY_CONTEXT.

Please suggest.

@ibmmqmet
Copy link
Collaborator

ibmmqmet commented Feb 4, 2025

If you have set the SET_ALL_CONTEXT flag, then the date/time comes from what you have explicitly set. Otherwise. the queue manager will set and overwrite the date/time values, based on the clock of the queue manager. Regardless of what you might have set in the MQMD.

This is described in the product documentation. See, for example, https://www.ibm.com/docs/en/ibm-mq/9.4?topic=descriptor-field-details-mqmd#q097395___q097640_

If your queue manager is running on a machine that's 7 seconds adrift of your client application, then that explains the difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants