Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding missing API for SBRM #13569

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ private ServiceBusReceivedMessage deserializeMessage(Message amqpMessage) {
brokeredMessage.setDeadLetterReason(String.valueOf(propertiesValue.get(DEAD_LETTER_REASON)));
}
if (propertiesValue.containsKey(DEAD_LETTER_DESCRIPTION)) {
brokeredMessage.setDeadLetterDescription(String.valueOf(propertiesValue.get(DEAD_LETTER_DESCRIPTION)));
brokeredMessage.setDeadLetterErrorDescription(String.valueOf(
propertiesValue.get(DEAD_LETTER_DESCRIPTION)));
}
}

Expand Down Expand Up @@ -385,6 +386,7 @@ private ServiceBusReceivedMessage deserializeMessage(Message amqpMessage) {
brokeredMessage.setDeadLetterSource((String) value);
break;
case ENQUEUED_SEQUENCE_NUMBER:
brokeredMessage.setEnqueuedSequenceNumber((long) value);
break;
default:
logger.info("Unrecognised key: {}, value: {}", key, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
public final class ServiceBusReceivedMessage {
private UUID lockToken;
private long sequenceNumber;
private long enqueuedSequenceNumber;
private long deliveryCount;
private Instant enqueuedTime;
private Instant lockedUntil;
Expand All @@ -39,7 +40,7 @@ public final class ServiceBusReceivedMessage {
private String to;
private String viaPartitionKey;
private String deadLetterReason;
private String deadLetterDescription;
private String deadLetterErrorDescription;

ServiceBusReceivedMessage(byte[] body) {
this.body = Objects.requireNonNull(body, "'body' cannot be null.");
Expand Down Expand Up @@ -91,8 +92,8 @@ public String getCorrelationId() {
*
* @return The description for a message that has been dead-lettered.
*/
public String getDeadLetterDescription() {
return deadLetterDescription;
public String getDeadLetterErrorDescription() {
return deadLetterErrorDescription;
}

/**
Expand Down Expand Up @@ -136,6 +137,21 @@ public long getDeliveryCount() {
return deliveryCount;
}

/**
* Gets the enqueued sequence number assigned to a message by Service Bus.
* <p>
* The sequence number is a unique 64-bit integer first assigned to a message as it is accepted at its original
* point of submission.
*
* @return enqueued sequence number of this message
*
* @see <a href="https://docs.microsoft.com/azure/service-bus-messaging/message-sequencing">Message Sequencing and
* Timestamps</a>
*/
public long getEnqueuedSequenceNumber() {
return this.enqueuedSequenceNumber;
}

/**
* Gets the instant at which this message was enqueued in Azure Service Bus.
* <p>
Expand Down Expand Up @@ -395,10 +411,10 @@ void setContentType(String contentType) {
/**
* Sets the dead letter description.
*
* @param deadLetterDescription Dead letter description.
* @param deadLetterErrorDescription Dead letter description.
*/
void setDeadLetterDescription(String deadLetterDescription) {
this.deadLetterDescription = deadLetterDescription;
void setDeadLetterErrorDescription(String deadLetterErrorDescription) {
this.deadLetterErrorDescription = deadLetterErrorDescription;
}

/**
Expand Down Expand Up @@ -430,6 +446,10 @@ void setDeliveryCount(long deliveryCount) {
this.deliveryCount = deliveryCount;
}

void setEnqueuedSequenceNumber(long enqueuedSequenceNumber) {
this.enqueuedSequenceNumber = enqueuedSequenceNumber;
}

/**
* Sets the instant at which this message was enqueued in Azure Service Bus.
*
Expand Down