Skip to content

Commit 8667a3e

Browse files
matthewbaldanfimov
authored andcommitted
Update message-format.md with serializer examples
Added examples for different serializers in the documentation. I found it a bit confusing to figure out how to use the existing serializers, so I felt the docs could be clarified here.
1 parent 40d041c commit 8667a3e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

docs/guide/message-format.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,43 @@ To install taskiq with libraries for non-JSON serializers, you should install ta
9191
pip install "taskiq[orjson]"
9292
```
9393

94+
```python
95+
# broker.py
96+
from taskiq import InMemoryBroker
97+
from taskiq.serializers import ORJSONSerializer
98+
99+
broker = InMemoryBroker().with_serializer(ORJSONSerializer())
100+
```
101+
102+
94103
@tab msgpack
95104

96105
```bash
97106
pip install "taskiq[msgpack]"
98107
```
99108

109+
```python
110+
# broker.py
111+
from taskiq import InMemoryBroker
112+
from taskiq.serializers import MSGPackSerializer
113+
114+
broker = InMemoryBroker().with_serializer(MSGPackSerializer())
115+
```
116+
100117
@tab cbor
101118

102119
```bash
103120
pip install "taskiq[cbor]"
104121
```
105122

123+
```python
124+
# broker.py
125+
from taskiq import InMemoryBroker
126+
from taskiq.serializers import CBORSerializer
127+
128+
broker = InMemoryBroker().with_serializer(CBORSerializer())
129+
```
130+
106131
:::
107132

108133
### Formatters

0 commit comments

Comments
 (0)