Skip to content

Support dynamic subject for sending via NATS #1297

Description

@mattdowdell

Similar to the problem described in #1115, protocol/nats/v2.Sender requires a subject to be set when calling NewSender or NewSenderFromConn. However, the subject can vary from send-to-send.

Curiously, Sender.Subject is in fact public, as are a surprising number of fields in that package. So a workaround might be to wrap it, add a mutex, and swap it out from send-to-send. However, that seems like a sub-par solution.

Would you be open to allowing the subject to be set for individual Send calls via a context accessor? NewSender and NewSenderFromConn don't appear to validate the subject, so we can set it to an empty value already.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions