Skip to content

fix(amqp): read native timestamp application properties - #763

Open
yangjj-iso wants to merge 1 commit into
cloudevents:mainfrom
yangjj-iso:fix-amqp-native-timestamps
Open

yangjj-iso wants to merge 1 commit into
cloudevents:mainfrom
yangjj-iso:fix-amqp-native-timestamps

Conversation

@yangjj-iso

Copy link
Copy Markdown

Fixes #762.

Native AMQP timestamps are decoded by Proton as java.util.Date. Calling Date.toString() produces a value such as Thu Jan 01 08:00:00 CST 1970, which the CloudEvents time parser rejects. Convert these values to canonical UTC timestamps with Time.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:

  • Original implementation: all six new cases fail with CloudEventRWException; 18 existing factory cases pass.
  • Fixed implementation: ./mvnw -pl amqp -am verify -Dmaven.javadoc.skip=true passes all 140 tests (API 8, core 90, AMQP 42), with no failures or skips.
  • git diff --check passes.
  • The initial verify run was stopped during Javadoc generation; the final successful run explicitly skips Javadoc. Full-repository and live-broker integration tests were not run.

AI assistance was used for investigation, implementation, and validation.

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>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

AMQP reader rejects native timestamp application properties

1 participant