A stream name not only identifies the stream, but also its purpose.
A stream name is made up of a category and an ID.
A category can include types that indicate even further specialized uses of the stream. An ID can be a single value or a compound ID made of multiple values.
The most minimal form of a stream name consists only of a category.
Stream names typically have up to three parts:
- Category Name
- Category Types
- Entity ID
# Stream Name with Category and ID
# Stream Name with Category and Compound IDs
# Stream Name with a Category Type
# Stream Name with Compound Category Types
# Stream Name with Compound Category Types and Compound ID
The Eventide toolkit provides a handful of utilities that institute useful and consistent standards for the various kinds of streams used in various common scenarios.
# Entity Stream Names
An entity stream name contains all of the events for one specific entity. For example, an
Account entity with an ID of
123 would have the name,
# Category Stream Names
A category stream name does not have an ID. For example, the stream name for the category of all accounts is
# Category Types
Stream names can also have an optional list of category types.
command type is one of the most common types. It's used to indicate a stream that is used to transport commands rather than events.
For example, a stream name for the stream that holds commands for the
account-123 entity would be named
The stream name is separated from the type list by the
Types can be present in both entity stream names as well as category stream names.
For example, the stream name for all commands for the
account category would be
# Compound Category Types
A stream name's category can have more than one type. The
+ symbol joins types when there are more than one.
For example, a stream name that keeps track of a consumer's last read position of a command category stream would be
# Entity IDs
An entity ID is any value in a stream name following the first
For a stream named
123 is the entity ID.
The ID itself can have
- characters in it. Only the first
- character in a stream name is significant. For a stream named
123-456 is the entity ID.
# Compound Entity IDs
A stream name can have more than on ID. The
+ symbol joins individual IDs when there are more than one.
For example, a stream name of the category
someStream that has the IDs
abc would be
# Cardinal ID
The cardinal ID is the first ID that appears in an entity stream's compound ID. If the stream name has only a single ID, then the cardinal ID is that single ID.
Stream names are camel-cased.
someStream is considered a valid stream name.
some_stream is not considered a valid stream name.
The casing of a stream name, however, is not enforced. The
some_stream form can be used, and it will not cause an error. Standard practice is to use camel case, and some utility methods, like the
category macro, will normalize the category name to camel case.
- The ID Separator
- character separates a stream's category and its ID.
+ The Compound ID Separator
+ character separates individual IDs in a stream name that has a combination of more than one ID.
: The Category Type Separator
The ':' character separates the category from the category type (or types) in a stream name that includes both a category and type.
+ The Compound Category Type Separator
+ character separates category types in a stream name that has a combination of more than one category type.