long
. The JMSTimestamp
header field contains the time a message was handed off to be sent. It is not the time the message was actually transmitted, because the actual send may occur later due to transactions or other client-side queueing of messages.
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 absolute time value in the Java programming language, which is the difference, measured in milliseconds, between the a given time and midnight, January 1, 1970 UTC.
// Example: Converting the current .NET time to Java millis time DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0); DateTime utcNow = DateTime.UtcNow; long timeInMillis = (utcNow.Ticks - baseTime.Ticks)/10000; Console.WriteLine(timeInMillis);
// Example: Converting Java millis time to .NET time DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0); long utcTimeTicks = (timeInMillis * 10000) + baseTime.Ticks; DateTime utcTime = new DateTime(utcTimeTicks, DateTimeKind.Utc); Console.WriteLine(utcTime); Console.WriteLine(utcTime.ToLocalTime());
Exception Type | Condition |
---|---|
MessageException | if JMS fails to get the timestamp due to some internal error. |
IMessage Interface | WebLogic.Messaging Namespace