File tree Expand file tree Collapse file tree 3 files changed +28
-8
lines changed
Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Original file line number Diff line number Diff line change 1- KAFKA_QUEUE = your_kafka_topic
2- KAFKA_BOOTSTRAP_SERVERS = localhost:9092
3- KAFKA_SECURITY_PROTOCOL = SASL_SSL
4- KAFKA_SASL_MECHANISMS = PLAIN
5- KAFKA_SASL_USERNAME = your_kafka_username
6- KAFKA_SASL_PASSWORD = your_kafka_password
7- KAFKA_GROUP_ID = your_consumer_group
1+ KAFKA_QUEUE = <kafka-topic>
2+ KAFKA_BOOTSTRAP_SERVERS = <kafka-bootstrap-servers>
3+ KAFKA_SECURITY_PROTOCOL = <kafka-security-protocol>
4+ KAFKA_SASL_MECHANISMS = <kafka-sasl-mechanisms>
5+ KAFKA_SASL_USERNAME = <kafka-sasl-username>
6+ KAFKA_SASL_PASSWORD = <kafka-sasl-password>
7+ KAFKA_GROUP_ID = <kafka-group-id>
Original file line number Diff line number Diff line change 11# kafka-queue
22
33- https://arnaud-lb.github.io/php-rdkafka-doc/phpdoc/rdkafka.installation.html
4+
5+ ### ServiceProvider (KafkaServiceProvider):
6+
7+ - Registers the Kafka queue connector with Laravel's queue manager.
8+
9+ ### Implements the QueueContract interface.
10+
11+ - Provides methods like push, pop, and size for interacting with Kafka.
12+ - push() pushes a serialized job to Kafka using the producer.
13+ - pop() consumes messages from Kafka and processes jobs.
14+
15+ ### Connector Class (KafkaConnector):
16+
17+ - Implements the ConnectorInterface.
18+ - Sets up Kafka producer and consumer.
Original file line number Diff line number Diff line change 44
55namespace Kafka \Providers ;
66
7+ use Kafka \Services \KafkaConnector ;
78use Illuminate \Support \ServiceProvider ;
89
910class KafkaServiceProvider extends ServiceProvider
1011{
11- public function boot ()
12+ public function boot (): void
1213 {
14+ /** @var QueueManager $queue */
15+ $ queue = $ this ->app ->make ('queue ' );
16+
17+ $ queue ->addConnector ('kafka ' , static fn () => new KafkaConnector ());
1318 }
1419}
You can’t perform that action at this time.
0 commit comments