gnodet opened a new pull request, #31256:
URL: https://github.com/apache/camel/pull/31256

   ## Summary
   
   Fix `CamelMessageTimestamp` (`Exchange.MESSAGE_TIMESTAMP`) in the PubNub 
consumer: it was set to the raw PubNub timetoken (a 17-digit count of 
100-nanosecond units since the epoch) instead of milliseconds.
   
   ## Root Cause
   
   PubNub timetokens are counts of 100-nanosecond intervals, **not** 
milliseconds. `PubNubConsumer` was setting `Exchange.MESSAGE_TIMESTAMP` 
directly to `message.getTimetoken()` / `presence.getTimetoken()` without 
conversion, so the value was off by a factor of 10,000.
   
   ## Fix
   
   Divide the timetoken by `10_000` before setting `Exchange.MESSAGE_TIMESTAMP` 
(the `CamelPubNubTimeToken` header continues to carry the raw timetoken 
unchanged). The `@Metadata` description on `PubNubConstants.MESSAGE_TIMESTAMP` 
is also corrected to reflect the millisecond contract.
   
   ## Tests
   
   Two new unit tests in `PubNubConsumerListenerTest`:
   - `testMessageTimestampIsMilliseconds` — verifies the header is `timetoken / 
10_000` for a regular message.
   - `testPresenceTimestampIsMilliseconds` — same for a presence event.
   
   Both also assert that `CamelPubNubTimeToken` still holds the raw timetoken, 
confirming the two headers carry different values as intended.
   
   Fixes CAMEL-28016
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to