This is the documentation for
v1.7 but the latest version is
v1.13
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show mateusjunges/laravel-kafka
SASL allows your producers and your consumers to authenticate to your Kafka cluster, which verifies their identity.
It's also a secure way to enable your clients to endorse an identity. To provide SASL configuration, you can use the withSasl
method,
passing a Junges\Kafka\Config\Sasl
instance as the argument:
$consumer = \Junges\Kafka\Facades\Kafka::createConsumer()
->withSasl(new \Junges\Kafka\Config\Sasl(
password: 'password',
username: 'username',
mechanisms: 'authentication mechanism',
));
You can also set the security protocol used with sasl. It's optional and by default SASL_PLAINTEXT
is used, but you can set it to SASL_SSL
:
$consumer = \Junges\Kafka\Facades\Kafka::createConsumer()
->withSasl(new \Junges\Kafka\Config\Sasl(
password: 'password',
username: 'username',
mechanisms: 'authentication mechanism',
securityProtocol: 'SASL_SSL',
));
Note: When using the withSasl
method, the securityProtocol set in this method takes priority over withSecurityProtocol
method.