Skip to content

Document message lifecycle #1961

@abemedia

Description

@abemedia

Proposed change

The Go docs should specify the *nats.Msg lifecycle. Looking at the code I can see that a new struct is allocated per message, however that doesn't give me the confidence to know that this wont change.

Use case

We have async processing of messages and there is no clear guidance on whether we can store a reference to the *nats.Msg received in the callback for later processing, or if it may be reused after the function returns. For safety I've opted for being defensive and copying the message before queueing it up for async processing, however if there was some documentation specifying the behaviour we could omit this extra step.

Contribution

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalEnhancement idea or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions