1
Install PHP extensions
Winter Kafka needs
swoole and rdkafka installed via PECL.2
Require the module
Add the modules package with Composer.
3
Enable in application.yml
Register the module and point it to your config file.
configFile is a file path relative to your config directory or an absolute path.kafka-config.yml
The Kafka config declares your bootstrap servers, consumer groups, and named producers. You can apply global defaults with the reserved__default__ name and override per group or producer as needed.
Autowired services
KafkaService is available to applications by default. Consumer workers start automatically when the framework boots, and all producers are enabled by default.
The reserved "__default__" consumer and producer entries can contain any rdkafka settings. Defaults apply to all producers and consumers; each individual entry may also specify its own rdkafka settings, which apply only to that producer or consumer.
Consumer properties
Producer properties
How to write a consumer worker
A consumer worker must implement theConsumer interface. In practice, extend AbstractConsumer and implement the consume method.