Reputation: 65
when I try to send a message from a topic to the dead letter queue I'd like to modify some of the message's properties. Just modifying the property will result in the message landing in the dead letter queue, however the changes are not present.
The Microsoft.Azure.ServiceBus.SubscriptionClient class has a DeadLetterAsync method which requires a dictionary with the properties I want to change. My code looks like this
Dictionary<string, object> properties = new Dictionary<string, object>
{
{ "To", $"{VALUE}" }
};
await subscriptionClient_.DeadLetterAsync(message.SystemProperties.LockToken, properties);
When I check the message with Service bus explorer the To value of Microsoft.Azure.ServiceBus.Message class is not updated.
Can someone please tell me how this method updates message properties?:
public Task DeadLetterAsync(string lockToken, IDictionary<string, object> propertiesToModify);
Upvotes: 2
Views: 1357
Reputation: 65
It looks like using the following method will add the dictionary values to the message as UserProperties.
public Task DeadLetterAsync(string lockToken, IDictionary<string, object> propertiesToModify);
Upvotes: 1