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
There are good articles about it:
General recommendations:
separate.with.dots.lowercase
- avoid capitalization.public.sales.ecommerce.shoppingcarts
private.risk.portfolio.analysis.loans.csvimport
.avro
, .json
, .text
, .protobuf
, .csv
, .log
.js.in.orders.>
(where .in
/.out
is the prefix for inbound or outbound messages).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?