Repository navigation
Conversation
Contributor
|
@yangjj-iso will this break existing users? |
Convert Proton Date attributes to canonical UTC timestamps before reading CloudEvents. Cover real AMQP encoding and decoding for both spec versions, including timestamp extensions, the epoch, and millisecond precision. Fixes cloudevents#762 Signed-off-by: redyyang <3202137046@qq.com>
duglin
force-pushed
the
fix-amqp-native-timestamps
branch
from
November 12, 2026 16:32
ffe4fc1 to
e1a6e6a
Compare
The Proton message factory tests pass, including native and textual timestamp coverage.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #762.
Native AMQP timestamps are decoded by Proton as
java.util.Date. CallingDate.toString()produces a value such asThu Jan 01 08:00:00 CST 1970, which the CloudEventstimeparser rejects. Convert these values to canonical UTC timestamps withTime.writeTime(), retaining millisecond precision and leaving other values unchanged.The AMQP binding §3.1.3.2 requires readers to handle native timestamp values as well as canonical strings. Six regression cases encode and decode real Proton messages for CloudEvents 0.3 and 1.0, covering the epoch, pre-epoch values, nonzero milliseconds, and a timestamp extension.
Validation on Temurin 21 / Maven wrapper:
CloudEventRWException; 18 existing factory cases pass../mvnw -pl amqp -am verify -Dmaven.javadoc.skip=truepasses all 140 tests (API 8, core 90, AMQP 42), with no failures or skips.git diff --checkpasses.AI assistance was used for investigation, implementation, and validation.
Compatibility
This is a reader-side change. Canonical timestamp strings and other non-timestamp values keep their existing handling. The standard
timeattribute now accepts a native AMQP timestamp in addition to a string. If an extension is transmitted as a native timestamp, its string value is now RFC3339 UTC rather than Java’s locale-dependentDate.toString()output. Consumers that compared that previous extension string literally may need to update the comparison. The writer’s wire format is unchanged.After synchronizing with
main, all 24 Proton message factory tests passed.