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 c0b25cacd605..db82428615ce 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. @@ -459,34 +458,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 5edc881140ca..f54b00122d0d 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; @@ -197,11 +196,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 74c6df584c82..f8be1fc7e21a 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. @@ -417,22 +416,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 +634,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 25076cedd4b7..2a3fba543663 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 0efb1892d664..d68db35652ce 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());