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
By default the transport serializes messages to json format but you might want to use another format such as [Apache Avro](https://avro.apache.org/docs/1.2.0/).
111
-
For that you have to implement Serializer interface and set it to the context, producer or consumer.
111
+
For that you have to implement Serializer interface and set it to the context, producer or consumer.
112
112
If a serializer set to context it will be injected to all consumers and producers created by the context.
113
113
114
114
```php
@@ -119,7 +119,7 @@ use Enqueue\RdKafka\RdKafkaMessage;
119
119
class FooSerializer implements Serializer
120
120
{
121
121
public function toMessage($string) {}
122
-
122
+
123
123
public function toString(RdKafkaMessage $message) {}
124
124
}
125
125
@@ -145,4 +145,44 @@ $consumer->setOffset(123);
145
145
$message = $consumer->receive(2000);
146
146
```
147
147
148
-
[back to index](index.md)
148
+
## Usage with Symfony bundle
149
+
150
+
Set your enqueue to use rdkafka as your transport
151
+
152
+
```yaml
153
+
# app/config/config.yml
154
+
155
+
enqueue:
156
+
default:
157
+
transport: "rdkafka:"
158
+
client: ~
159
+
```
160
+
161
+
You can also you extended configuration to pass additional options, if you don't want to pass them via DSN string or
162
+
need to pass specific options. Since rdkafka uses librdkafka (being basically a wrapper around it) most configuration
163
+
options are identical to those found at https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md.
164
+
165
+
```yaml
166
+
# app/config/config.yml
167
+
168
+
enqueue:
169
+
default:
170
+
transport:
171
+
dsn: "rdkafka://"
172
+
global:
173
+
### Make sure this is unique for each application / consumer group and does not change
174
+
### Otherwise, Kafka won't be able to track your last offset and will always start according to
175
+
### `auto.offset.reset` setting.
176
+
### See Kafka documentation regarding `group.id` property if you want to know more
177
+
group.id: 'foo-app'
178
+
metadata.broker.list: 'example.com:1000'
179
+
topic:
180
+
auto.offset.reset: beginning
181
+
### Commit async is true by default since version 0.9.9.
182
+
### It is suggested to set it to true in earlier versions since otherwise consumers become extremely slow,
183
+
### waiting for offset to be stored on Kafka before continuing.
0 commit comments