Message Publisher

Custom Publisher

To create custom publisher or consumer provide Service Context.

circle-check

Custom Publisher

class MessagingConfiguration
{
    #[ServiceContext] 
    public function distributedPublisher()
    {
        return KafkaPublisherConfiguration::createWithDefaults(
            topicName: 'orders'
        );
    }
}

Then Publisher will be available for us in Dependency Container under MessagePublisher reference. This will make it available in your dependency container under MessagePublisher name.

Providing custom rdkafka configuration

You can modify your Message Publisher with specific rdkafka configurationarrow-up-right:

Last updated

Was this helpful?