Replacing the default serializer/deserializer

The default Serializer is resolved using the MessageSerializer and MessageDeserializer contracts. Out of the box, the Json serializers are used.

Support Laravel Kafka by sponsoring me!

Do you find Laravel Kafka valuable and wanna support its development?

Laravel Kafka is free and Open Source software, built to empower developers like you. Your support helps maintain and enhance the project. If you find it valuable, please consider sponsoring me on GitHub. Every contribution makes a difference and keeps the development going strong! Thank you!

Want to hide this message? Sponsor at any tier of $10/month or more!

To set the default serializer you can bind the MessageSerializer and MessageDeserializer contracts to any class which implements this interfaces.

Open your AppServiceProvider class and add this lines to the register method:

$this->app->bind(\Junges\Kafka\Contracts\MessageSerializer::class, function () {
   return new MyCustomSerializer();
});

$this->app->bind(\Junges\Kafka\Contracts\MessageDeserializer::class, function() {
    return new MyCustomDeserializer();
});
Previous
Queueable handlers