Skip to content

Commit 70d49f4

Browse files
authored
[Service Bus] Remove viaPartitionKey (Azure#17501)
* [Service Bus] Remove viaPartitionKey * Remove unused imports
1 parent 7942159 commit 70d49f4

File tree

5 files changed

+0
-70
lines changed

5 files changed

+0
-70
lines changed

sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessage.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import static com.azure.core.amqp.AmqpMessageConstant.PARTITION_KEY_ANNOTATION_NAME;
2929
import static com.azure.core.amqp.AmqpMessageConstant.SCHEDULED_ENQUEUE_UTC_TIME_NAME;
3030
import static com.azure.core.amqp.AmqpMessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME;
31-
import static com.azure.core.amqp.AmqpMessageConstant.VIA_PARTITION_KEY_ANNOTATION_NAME;
3231

3332
/**
3433
* The data structure encapsulating the message being sent-to Service Bus.
@@ -459,34 +458,6 @@ public ServiceBusMessage setReplyToSessionId(String replyToSessionId) {
459458
return this;
460459
}
461460

462-
/**
463-
* Gets the partition key for sending a message to a entity via another partitioned transfer entity.
464-
*
465-
* If a message is sent via a transfer queue in the scope of a transaction, this value selects the transfer queue
466-
* partition: This is functionally equivalent to {@link #getPartitionKey()} and ensures that messages are kept
467-
* together and in order as they are transferred.
468-
*
469-
* @return partition key on the via queue.
470-
* @see <a href="https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via">Transfers
471-
* and Send Via</a>
472-
*/
473-
public String getViaPartitionKey() {
474-
return (String) amqpAnnotatedMessage.getMessageAnnotations().get(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue());
475-
}
476-
477-
/**
478-
* Sets a via-partition key for sending a message to a destination entity via another partitioned entity
479-
*
480-
* @param viaPartitionKey via-partition key of this message
481-
*
482-
* @return The updated {@link ServiceBusMessage}.
483-
* @see #getViaPartitionKey()
484-
*/
485-
public ServiceBusMessage setViaPartitionKey(String viaPartitionKey) {
486-
amqpAnnotatedMessage.getMessageAnnotations().put(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue(), viaPartitionKey);
487-
return this;
488-
}
489-
490461
/**
491462
* Gets the session id of the message.
492463
*

sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusMessageSerializer.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import static com.azure.core.amqp.AmqpMessageConstant.SCHEDULED_ENQUEUE_UTC_TIME_NAME;
77
import static com.azure.core.amqp.AmqpMessageConstant.PARTITION_KEY_ANNOTATION_NAME;
8-
import static com.azure.core.amqp.AmqpMessageConstant.VIA_PARTITION_KEY_ANNOTATION_NAME;
98
import com.azure.core.amqp.exception.AmqpResponseCode;
109
import com.azure.core.amqp.implementation.MessageSerializer;
1110
import com.azure.core.amqp.implementation.RequestResponseUtils;
@@ -197,11 +196,6 @@ public <T> Message serialize(T object) {
197196
brokeredMessage.getPartitionKey());
198197
}
199198

200-
final String viaPartitionKey = brokeredMessage.getViaPartitionKey();
201-
if (viaPartitionKey != null && !viaPartitionKey.isEmpty()) {
202-
messageAnnotationsMap.put(Symbol.valueOf(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue()), viaPartitionKey);
203-
}
204-
205199
amqpMessage.setMessageAnnotations(new MessageAnnotations(messageAnnotationsMap));
206200

207201
// Set Delivery Annotations.

sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusReceivedMessage.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import static com.azure.core.amqp.AmqpMessageConstant.PARTITION_KEY_ANNOTATION_NAME;
3030
import static com.azure.core.amqp.AmqpMessageConstant.SCHEDULED_ENQUEUE_UTC_TIME_NAME;
3131
import static com.azure.core.amqp.AmqpMessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME;
32-
import static com.azure.core.amqp.AmqpMessageConstant.VIA_PARTITION_KEY_ANNOTATION_NAME;
3332

3433
/**
3534
* This class represents a received message from Service Bus.
@@ -417,22 +416,6 @@ public String getTo() {
417416
return amqpAnnotatedMessage.getProperties().getTo();
418417
}
419418

420-
/**
421-
* Gets the partition key for sending a message to a entity via another partitioned transfer entity.
422-
*
423-
* If a message is sent via a transfer queue in the scope of a transaction, this value selects the
424-
* transfer queue partition: This is functionally equivalent to {@link #getPartitionKey()} and ensures that
425-
* messages are kept together and in order as they are transferred.
426-
*
427-
* @return partition key on the via queue.
428-
*
429-
* @see <a href="https://docs.microsoft.com/azure/service-bus-messaging/service-bus-transactions#transfers-and-send-via">Transfers and Send Via</a>
430-
*/
431-
public String getViaPartitionKey() {
432-
return getStringValue(amqpAnnotatedMessage.getMessageAnnotations(),
433-
VIA_PARTITION_KEY_ANNOTATION_NAME.getValue());
434-
}
435-
436419
/**
437420
* Gets whether the message has been settled.
438421
*
@@ -651,17 +634,6 @@ void setTo(String to) {
651634
amqpAnnotatedMessage.getProperties().setTo(to);
652635
}
653636

654-
/**
655-
* Sets a via-partition key for sending a message to a destination entity via another partitioned entity
656-
*
657-
* @param viaPartitionKey via-partition key of this message
658-
*
659-
* @see #getViaPartitionKey()
660-
*/
661-
void setViaPartitionKey(String viaPartitionKey) {
662-
amqpAnnotatedMessage.getMessageAnnotations().put(VIA_PARTITION_KEY_ANNOTATION_NAME.getValue(), viaPartitionKey);
663-
}
664-
665637
/*
666638
* Gets String value from given map and null if key does not exists.
667639
*/

sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/ManagementChannel.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,6 @@ public Flux<Long> schedule(List<ServiceBusMessage> messages, OffsetDateTime sche
346346
messageEntry.put(ManagementConstants.PARTITION_KEY, partitionKey);
347347
}
348348

349-
final String viaPartitionKey = message.getViaPartitionKey();
350-
if (!CoreUtils.isNullOrEmpty(viaPartitionKey)) {
351-
messageEntry.put(ManagementConstants.VIA_PARTITION_KEY, viaPartitionKey);
352-
}
353-
354349
messageList.add(messageEntry);
355350
}
356351

sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusReceivedMessageTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public void toServiceBusMessageTest() {
102102
originalMessage.setContentType("type");
103103
originalMessage.setCorrelationId("cid");
104104
originalMessage.setReplyTo("rto");
105-
originalMessage.setViaPartitionKey("something");
106105
originalMessage.setTimeToLive(Duration.ofSeconds(10));
107106
originalMessage.setReplyToSessionId("rsessionid");
108107
originalMessage.setSubject("subject");
@@ -132,7 +131,6 @@ public void toServiceBusMessageTest() {
132131
assertEquals(originalMessage.getContentType(), actual.getContentType());
133132
assertEquals(originalMessage.getCorrelationId(), actual.getCorrelationId());
134133
assertEquals(originalMessage.getReplyTo(), actual.getReplyTo());
135-
assertEquals(originalMessage.getViaPartitionKey(), actual.getViaPartitionKey());
136134
assertEquals(originalMessage.getTimeToLive().toMillis(), actual.getTimeToLive().toMillis());
137135
assertEquals(originalMessage.getLabel(), actual.getSubject());
138136
assertEquals(originalMessage.getReplyToSessionId(), actual.getReplyToSessionId());

0 commit comments

Comments
 (0)