You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/message_bus.md
+36-24
Original file line number
Diff line number
Diff line change
@@ -77,11 +77,14 @@ your `TradingNodeConfig`. Each of these config options will be described below.
77
77
message_bus=MessageBusConfig(
78
78
database=DatabaseConfig(),
79
79
encoding="json",
80
-
stream="streams",
81
-
use_instance_id=False,
82
80
timestamps_as_iso8601=True,
83
-
types_filter=[QuoteTick, TradeTick],
81
+
buffer_interval_ms=100,
84
82
autotrim_mins=30,
83
+
use_trader_prefix=True,
84
+
use_trader_id=True,
85
+
use_instance_id=False,
86
+
streams_prefix="streams",
87
+
types_filter=[QuoteTick, TradeTick],
85
88
)
86
89
...
87
90
```
@@ -90,27 +93,6 @@ message_bus=MessageBusConfig(
90
93
A `DatabaseConfig` must be provided, for a default Redis setup on the local
91
94
loopback you can pass a `DatabaseConfig()`, which will use defaults to match.
92
95
93
-
### Trader keys
94
-
95
-
Trader keys are essential for identifying individual trader nodes and organizing messages within streams.
96
-
They can be tailored to meet your specific requirements and use cases. In the context of message bus streams, a trader key is typically structured as follows:
97
-
98
-
```
99
-
{stream}:{trader_id}:{instance_id}
100
-
```
101
-
102
-
The following options are available for configuring trader keys:
103
-
104
-
#### Stream
105
-
The `stream` string allows you to group all streams for a single trader instance, or organize messages related to a group of trader instances.
106
-
By configuring this grouping behavior, pass a string to the `stream` configuration option.
107
-
108
-
#### Instance ID
109
-
110
-
Each trader node is assigned a unique 'instance ID,' which is a UUIDv4. This instance ID helps distinguish individual traders when messages
111
-
are distributed across multiple streams. You can include the instance ID in the trader key by setting the `use_instance_id` configuration option to `True`.
112
-
This is particularly useful when you need to track and identify traders across various streams in a multi-node trading system.
113
-
114
96
### Encoding
115
97
116
98
Two encodings are currently supported by the built-in `Serializer` used by the `MessageBus`:
@@ -129,6 +111,36 @@ It's recommended to use `json` encoding for human readability when performance i
129
111
By default timestamps are formatted as UNIX epoch nanosecond integers. Alternatively you can
130
112
configure ISO 8601 string formatting by setting the `timestamps_as_iso8601` to `True`.
131
113
114
+
### Message stream keys
115
+
116
+
Message stream keys are essential for identifying individual trader nodes and organizing messages within streams.
117
+
They can be tailored to meet your specific requirements and use cases. In the context of message bus streams, a trader key is typically structured as follows:
118
+
119
+
```
120
+
trader:{trader_id}:{instance_id}:{streams_prefix}
121
+
```
122
+
123
+
The following options are available for configuring message stream keys:
124
+
125
+
#### Trader prefix
126
+
127
+
If the key should begin with the `trader` string.
128
+
129
+
#### Trader ID
130
+
131
+
If the key should include the trader ID for the node.
132
+
133
+
#### Instance ID
134
+
135
+
Each trader node is assigned a unique 'instance ID,' which is a UUIDv4. This instance ID helps distinguish individual traders when messages
136
+
are distributed across multiple streams. You can include the instance ID in the trader key by setting the `use_instance_id` configuration option to `True`.
137
+
This is particularly useful when you need to track and identify traders across various streams in a multi-node trading system.
138
+
139
+
#### Streams prefix
140
+
141
+
The `streams_prefix` string allows you to group all streams for a single trader instance, or organize messages related to a group of trader instances.
142
+
By configuring this grouping behavior, pass a string to the `streams_prefix` configuration option (with other prefixes false).
143
+
132
144
### Types filtering
133
145
134
146
When messages are published on the message bus, they are serialized and written to a stream, provided that a backing for the message bus has been configured and enabled.
0 commit comments