Reputation: 396
How can we add custom properties or application properties with the latest SDK azure-messaging-servicebus?
It seems something doable in the previous package com.microsoft.azure:azure-servicebu like the method setProperties(Map<String,Object> properties) but I cannot find anything with the new SDK...
It is also something doable with the .Net or Javascript SDK .
Upvotes: 1
Views: 3297
Reputation: 7790
Setting application properties can be accomplished by using the ApplicationProperties
map on ServiceBusMessage
. For example:
ServiceBusMessage message = new ServiceBusMessage(ServiceBusMessage(BinaryData.fromString("Hello"));
message.getApplicationProperties().put("EventType", "com.microsoft.samples.hello-event");
message.getApplicationProperties().put("priority", 1);
message.getApplicationProperties().put("score", 9.0);
More context can be found in the ServiceBusMessage docs.
Upvotes: 4