ServiceBusMessage.SendMessageAsync returns after await a task but I don't see how to get from the result the Sequence Number assigned by service bus in a queue for this message.
Is it possible to get the SequenceNumber (similar to ServiceBusReceivedMessage.SequenceNumber) some other way for each message sent at the time the task returns?
ServiceBusMessage newStateMessage = new ServiceBusMessage(newStateJson);
await newStateSender.SendMessageAsync(newStateMessage);
Thank you
In short, the data that you're looking for does not exist when SendMessageAsync
returns. The only way to query the sequence number is to peek or receive the message.
When SendMessageAsync
returns, Service Bus has acknowledged receipt of the message and assumed responsibility for it, but it has not yet been fully committed to a queue/topic. The sequence number is assigned by Service Bus when the message is committed.