Skip to content

Commit

Permalink
adding missing API for SBRM (#13569)
Browse files Browse the repository at this point in the history
* adding missing API for ServiceBusReceivedMEssage
  • Loading branch information
hemanttanwar authored Jul 29, 2020
1 parent e51d01f commit be4b566
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
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

0 comments on commit be4b566

Please sign in to comment.