commandnats.ionats-jetstream

Nats/Jetstream: naming conventions for commands' subjects


I have been working with Nats/Jetstream for a bit now and within a CQRS/Event sourcing project. Recently, it occurred to me that I have not been following any naming conventions for subjects' names that are used for commands (events are pretty much covered). What have been doing so far is, as follows:

myProjectName.internal.pricing

Meaning the myProjectName as my project name, internal as it is internal to a specific service in my project and then ultimately the action performed by that command (e.g. some pricing logic). Are there any widely used naming conventions I can use? I would appreciate if you can share any view or resource I can use to have a better naming across my project.

Thank you


Solution

  • There are good articles about it:

    General recommendations:

    public.sales.ecommerce.shoppingcarts
    private.risk.portfolio.analysis.loans.csvimport
    

    What should be avoided?

    public.com.xeotek.sales.ecommerce.shoppingcarts
    

    Similar question about Kafka topics best practices: What is the best practice for naming kafka topics?