Solace Go API - Setting custom headers on outbound messages
Hey,
I have started, looking into the der Solace Go API 1.1
solace.dev/go/messaging v1.0.1
I started looking into the processing of incoming messages and then pass them on onto a next channel/topic.
But as far as I can see in the API, there is no way to set custom properties/headers in an outbound message. The OutboundMessageBuilder has a
MessagePropertiesConfigurationProvider
that only exposes a map with already defined constants as keys.
Am I missing a property call here or is this a gap in the API?
Best Answer
-
Hey @jan_maretzki ! You can for sure add additional properties to your message when building the outbound message. When you process your incoming message and start building your other message, you can add a
.WithPropoerty
to your MessageBuilder as followsmessageBuilder := messagingService.MessageBuilder(). WithProperty("Key", "Value"). WithProperty("Key", "Value")
And on the receiving end you can use
message.GetProperties()
which returns an sdt.Map of propertiesYou can see an example here
https://github.com/SolaceSamples/solace-samples-go/blob/main/patterns/direct_publisher.go#L67-L71
0
Answers
-
Hey @jan_maretzki ! You can for sure add additional properties to your message when building the outbound message. When you process your incoming message and start building your other message, you can add a
.WithPropoerty
to your MessageBuilder as followsmessageBuilder := messagingService.MessageBuilder(). WithProperty("Key", "Value"). WithProperty("Key", "Value")
And on the receiving end you can use
message.GetProperties()
which returns an sdt.Map of propertiesYou can see an example here
https://github.com/SolaceSamples/solace-samples-go/blob/main/patterns/direct_publisher.go#L67-L71
0 -
Seemed to be I was too deep in, thanks!
1