From 026370a6258be7f765071d5209aac56af425e781 Mon Sep 17 00:00:00 2001 From: Yi Liu Date: Tue, 6 Jul 2021 10:55:21 +0800 Subject: [PATCH] Fix bug of converting system properties from EventData to Spring message in Eventhub binder (#22683) * fix bug of converting system properties * add changelog --- sdk/spring/azure-spring-cloud-autoconfigure/CHANGELOG.md | 2 ++ sdk/spring/azure-spring-cloud-starter-eventhubs/CHANGELOG.md | 2 ++ .../azure-spring-cloud-stream-binder-eventhubs/CHANGELOG.md | 2 ++ .../test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java | 2 +- sdk/spring/azure-spring-integration-eventhubs/CHANGELOG.md | 3 ++- .../eventhub/converter/EventHubMessageConverter.java | 1 + 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/CHANGELOG.md b/sdk/spring/azure-spring-cloud-autoconfigure/CHANGELOG.md index 687d8450ee455..fad9ca8057076 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/CHANGELOG.md +++ b/sdk/spring/azure-spring-cloud-autoconfigure/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 2.7.0-beta.1 (Unreleased) +### Key Bug Fixes +- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/)) ## 2.6.0 (2021-06-23) diff --git a/sdk/spring/azure-spring-cloud-starter-eventhubs/CHANGELOG.md b/sdk/spring/azure-spring-cloud-starter-eventhubs/CHANGELOG.md index 3248babe9b530..f1fa6b3d3655c 100644 --- a/sdk/spring/azure-spring-cloud-starter-eventhubs/CHANGELOG.md +++ b/sdk/spring/azure-spring-cloud-starter-eventhubs/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 2.7.0-beta.1 (Unreleased) +### Key Bug Fixes +- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/)) ## 2.6.0 (2021-06-23) diff --git a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/CHANGELOG.md b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/CHANGELOG.md index b215096d45d3f..f7e6fef518b1e 100644 --- a/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/CHANGELOG.md +++ b/sdk/spring/azure-spring-cloud-stream-binder-eventhubs/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 2.7.0-beta.1 (Unreleased) +### Key Bug Fixes +- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/)) ## 2.6.0 (2021-06-23) diff --git a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java index 04beabae4cd9b..3af3e3676444b 100644 --- a/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java +++ b/sdk/spring/azure-spring-cloud-test-eventhubs/src/test/java/com/azure/spring/test/eventhubs/stream/binder/EventHubBinderSyncModeIT.java @@ -66,7 +66,7 @@ public Supplier>> supply(Sinks.Many> many) public Consumer> consume() { return message -> { LOGGER.info("EventHubBinderRecordModeIT: New message received: '{}'", message.getPayload()); - if (message.getPayload().equals(EventHubBinderSyncModeIT.message)) { + if (message.getPayload().equals(EventHubBinderSyncModeIT.message) && message.getHeaders().containsKey("x-opt-enqueued-time")) { latch.countDown(); } }; diff --git a/sdk/spring/azure-spring-integration-eventhubs/CHANGELOG.md b/sdk/spring/azure-spring-integration-eventhubs/CHANGELOG.md index 938a09f9ac14b..1dc8cfa1057ab 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/CHANGELOG.md +++ b/sdk/spring/azure-spring-integration-eventhubs/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History ## 2.7.0-beta.1 (Unreleased) - +### Key Bug Fixes +- Fixed `EventHubMessageConverter` to load all system properties of `EventData` and put in the header of org.springframework.messaging.Message.([#22683](https://github.com/Azure/azure-sdk-for-java/pull/22683/)) ## 2.6.0 (2021-06-23) ### New Features diff --git a/sdk/spring/azure-spring-integration-eventhubs/src/main/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverter.java b/sdk/spring/azure-spring-integration-eventhubs/src/main/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverter.java index 7b5fdc19a2e59..902beb8bc57db 100644 --- a/sdk/spring/azure-spring-integration-eventhubs/src/main/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverter.java +++ b/sdk/spring/azure-spring-integration-eventhubs/src/main/java/com/azure/spring/integration/eventhub/converter/EventHubMessageConverter.java @@ -86,6 +86,7 @@ protected Map buildCustomHeaders(EventData azureMessage) { private Map getSystemProperties(EventData azureMessage) { Map result = new HashMap<>(); + result.putAll(azureMessage.getSystemProperties()); result.put(EventHubHeaders.ENQUEUED_TIME, azureMessage.getEnqueuedTime()); result.put(EventHubHeaders.OFFSET, azureMessage.getOffset()); result.put(EventHubHeaders.SEQUENCE_NUMBER, azureMessage.getSequenceNumber());