Open lilytrotter opened 8 months ago
If I understand the current nats_jetstream
protocol implementation correctly, it ignores this header during the CE conversion: https://github.com/cloudevents/sdk-go/blob/e6a74efbacbf4ac70fc8ed598e678f94b6be7a6d/protocol/nats_jetstream/v2/message.go#L57-L97
IMHO it can be added without breaking the API similar to what we do in the Kafka protocol bindings.
I'd be happy with a change to enable this, but not sure on the correct approach. I'm not too familiar to how other protocol bindings work, but http just has an exported struct field:
If you did something similar, users can then just do the following:
var msg binding.Message
if msg, ok := msg.(*jetstreamv2.Message); ok {
fmt.Println(msg.Header)
}
Hi, folks! Is it possible to access the special NATS headers on send, for example Nats-Expected-Last-Sequence
These headers would allow event sourcing with CloudEvents. The neat thing is that consumers don't need to do anything. It's more like a quality of service between NATS client and the server.
If not currently possible, are there workarounds? Could we find a way to add support without breaking the current API?