nats-io/nats.net.v2

Message flags

Closed this issue · 1 comments

mtmk commented

Proposed change

Add a message flags enum to NatsMsg to indicate important message states:

  • Message payload is empty
  • Messages is a No responders error message

Use case

Currently we rely on message Data being null to indicate that a message is empty which doesn't work reliably when it comes to value types. For example for int a 0 (zero) might mean an empty payload or actual 0 being passed as payload. So we can't rely on the default values.

Also no-responders message from the server has a specific format which can be detected much easier and flagged while building the message.

Since NatsMsg is a struct we should be careful not to bloat it hence we can use a flags enum to minimize the impact.

mtmk commented

Closing in favor of #277 and not to stretch already too big NatsMsg struct any further.