Extracting message ID on solace pub sub broker in golang API
lukamacan
Member Posts: 2 ✭
Hello everyone, currently I am researching Solace GoLang Api and I have few questions. Can you please help me because I cannot find the answer.
- How can I extract message ID or is there any unique ID that can be extracted from Inbound message and used for distinguishing messaged published to message broker
- I would also like to know how to set sequence number on publisher side. Right now I am using GetSequenceNumber() method and can't get anything but 0 because it is not set on publisher side.
Tnx for help in advance
Tagged:
0
Comments
-
Hi @lukamacan, thanks for the question,
- There are a couple different message IDs on any given message. There is the Message ID which is simply an incrementing count of message delivery, but does not uniquely identify a message. This is not available in the Go API. There is the Replication Group Message ID which is guaranteed to be unique within a replication group and should be used when uniquely identifying a message. See
GetReplicationGroupMessageID
on https://pkg.go.dev/solace.dev/go/messaging@v1.1.0/pkg/solace/message#InboundMessage. - If you are using a Go API publisher, you can use the OutboundMessageBuilder from
MessagingService.MessageBuilder()
, in particularWithSequenceNumber
on https://pkg.go.dev/solace.dev/go/messaging@v1.1.0/pkg/solace#OutboundMessageBuilder.
Hope that helps!
1 - There are a couple different message IDs on any given message. There is the Message ID which is simply an incrementing count of message delivery, but does not uniquely identify a message. This is not available in the Go API. There is the Replication Group Message ID which is guaranteed to be unique within a replication group and should be used when uniquely identifying a message. See