From 083e26935abff4039839dfd24b7820f73d3403d6 Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Wed, 11 Nov 2020 17:48:54 -0800 Subject: [PATCH 1/2] [Service Bus] Remove viaPartitionKey --- .../servicebus/ServiceBusMessage.java | 28 ------------------- .../ServiceBusMessageSerializer.java | 5 ---- .../servicebus/ServiceBusReceivedMessage.java | 27 ------------------ .../implementation/ManagementChannel.java | 5 ---- .../ServiceBusReceivedMessageTest.java | 2 -- 5 files changed, 67 deletions(-) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java index c0b25cacd6058..89bf7c765cb86 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java @@ -459,34 +459,6 @@ public ServiceBusMessage setReplyToSessionId(String replyToSessionId) { return this; } - /** - * Gets the partition key for sending a message to a entity via another partitioned transfer entity. - * - * If a message is sent via a transfer queue in the scope of a transaction, this value selects the transfer queue - * partition: This is functionally equivalent to {@link #getPartitionKey()} and ensures that messages are kept - * together and in order as they are transferred. - * - * @return partition key on the via queue. - * @see Transfers - * and Send Via - */ - public String getViaPartitionKey() { - return (String) amqpAnnotatedMessage.getMessageAnnotations().get(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue()); - } - - /** - * Sets a via-partition key for sending a message to a destination entity via another partitioned entity - * - * @param viaPartitionKey via-partition key of this message - * - * @return The updated {@link ServiceBusMessage}. - * @see #getViaPartitionKey() - */ - public ServiceBusMessage setViaPartitionKey(String viaPartitionKey) { - amqpAnnotatedMessage.getMessageAnnotations().put(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue(), viaPartitionKey); - return this; - } - /** * Gets the session id of the message. * diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java index 5edc881140cae..ab9eec4d0937d 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java @@ -197,11 +197,6 @@ public Message serialize(T object) { brokeredMessage.getPartitionKey()); } - final String viaPartitionKey = brokeredMessage.getViaPartitionKey(); - if (viaPartitionKey != null && !viaPartitionKey.isEmpty()) { - messageAnnotationsMap.put(Symbol.valueOf(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue()), viaPartitionKey); - } - amqpMessage.setMessageAnnotations(new MessageAnnotations(messageAnnotationsMap)); // Set Delivery Annotations. diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java index 74c6df584c826..4ea7e5b1b59aa 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java @@ -417,22 +417,6 @@ public String getTo() { return amqpAnnotatedMessage.getProperties().getTo(); } - /** - * Gets the partition key for sending a message to a entity via another partitioned transfer entity. - * - * If a message is sent via a transfer queue in the scope of a transaction, this value selects the - * transfer queue partition: This is functionally equivalent to {@link #getPartitionKey()} and ensures that - * messages are kept together and in order as they are transferred. - * - * @return partition key on the via queue. - * - * @see Transfers and Send Via - */ - public String getViaPartitionKey() { - return getStringValue(amqpAnnotatedMessage.getMessageAnnotations(), - VIA_PARTITION_KEY_ANNOTATION_NAME.getValue()); - } - /** * Gets whether the message has been settled. * @@ -651,17 +635,6 @@ void setTo(String to) { amqpAnnotatedMessage.getProperties().setTo(to); } - /** - * Sets a via-partition key for sending a message to a destination entity via another partitioned entity - * - * @param viaPartitionKey via-partition key of this message - * - * @see #getViaPartitionKey() - */ - void setViaPartitionKey(String viaPartitionKey) { - amqpAnnotatedMessage.getMessageAnnotations().put(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue(), viaPartitionKey); - } - /* * Gets String value from given map and null if key does not exists. */ diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ManagementChannel.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ManagementChannel.java index 25076cedd4b74..2a3fba543663b 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ManagementChannel.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ManagementChannel.java @@ -346,11 +346,6 @@ public Flux schedule(List messages, OffsetDateTime sche messageEntry.put(ManagementConstants.PARTITION_KEY, partitionKey); } - final String viaPartitionKey = message.getViaPartitionKey(); - if (!CoreUtils.isNullOrEmpty(viaPartitionKey)) { - messageEntry.put(ManagementConstants.VIA_PARTITION_KEY, viaPartitionKey); - } - messageList.add(messageEntry); } diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java index 0efb1892d6649..d68db35652ce8 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java @@ -102,7 +102,6 @@ public void toServiceBusMessageTest() { originalMessage.setContentType("type"); originalMessage.setCorrelationId("cid"); originalMessage.setReplyTo("rto"); - originalMessage.setViaPartitionKey("something"); originalMessage.setTimeToLive(Duration.ofSeconds(10)); originalMessage.setReplyToSessionId("rsessionid"); originalMessage.setSubject("subject"); @@ -132,7 +131,6 @@ public void toServiceBusMessageTest() { assertEquals(originalMessage.getContentType(), actual.getContentType()); assertEquals(originalMessage.getCorrelationId(), actual.getCorrelationId()); assertEquals(originalMessage.getReplyTo(), actual.getReplyTo()); - assertEquals(originalMessage.getViaPartitionKey(), actual.getViaPartitionKey()); assertEquals(originalMessage.getTimeToLive().toMillis(), actual.getTimeToLive().toMillis()); assertEquals(originalMessage.getLabel(), actual.getSubject()); assertEquals(originalMessage.getReplyToSessionId(), actual.getReplyToSessionId()); From 1a1c070415fb86939fa54db5297a83dca883d92a Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Wed, 11 Nov 2020 18:07:32 -0800 Subject: [PATCH 2/2] Remove unused imports --- .../java/com/azure/messaging/servicebus/ServiceBusMessage.java | 1 - .../azure/messaging/servicebus/ServiceBusMessageSerializer.java | 1 - .../azure/messaging/servicebus/ServiceBusReceivedMessage.java | 1 - 3 files changed, 3 deletions(-) diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java index 89bf7c765cb86..db82428615ce2 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java @@ -28,7 +28,6 @@ import static com.azure.core.amqp.AmqpMessageConstant.PARTITION_KEY_ANNOTATION_NAME; import static com.azure.core.amqp.AmqpMessageConstant.SCHEDULED_ENQUEUE_UTC_TIME_NAME; import static com.azure.core.amqp.AmqpMessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; -import static com.azure.core.amqp.AmqpMessageConstant.VIA_PARTITION_KEY_ANNOTATION_NAME; /** * The data structure encapsulating the message being sent-to Service Bus. diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java index ab9eec4d0937d..f54b00122d0db 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java @@ -5,7 +5,6 @@ import static com.azure.core.amqp.AmqpMessageConstant.SCHEDULED_ENQUEUE_UTC_TIME_NAME; import static com.azure.core.amqp.AmqpMessageConstant.PARTITION_KEY_ANNOTATION_NAME; -import static com.azure.core.amqp.AmqpMessageConstant.VIA_PARTITION_KEY_ANNOTATION_NAME; import com.azure.core.amqp.exception.AmqpResponseCode; import com.azure.core.amqp.implementation.MessageSerializer; import com.azure.core.amqp.implementation.RequestResponseUtils; diff --git a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java index 4ea7e5b1b59aa..f8be1fc7e21ab 100644 --- a/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java +++ b/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java @@ -29,7 +29,6 @@ import static com.azure.core.amqp.AmqpMessageConstant.PARTITION_KEY_ANNOTATION_NAME; import static com.azure.core.amqp.AmqpMessageConstant.SCHEDULED_ENQUEUE_UTC_TIME_NAME; import static com.azure.core.amqp.AmqpMessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; -import static com.azure.core.amqp.AmqpMessageConstant.VIA_PARTITION_KEY_ANNOTATION_NAME; /** * This class represents a received message from Service Bus.