Publishes the body of the request as a message to an Apache Kafka topic.
The interceptor needs the Membrane Kafka Extension. Without the extension Membrane does not start. Contact predic8 for the extension.
Example Configuration
kafkaProducer:
bootstrapServers: kafka.example.com:9092
topic: orders
key: headers['X-Order-Id']kafkaProducer: bootstrapServers: kafka.example.com:9092 topic: orders key: headers['X-Order-Id']
Syntax
kafkaProducer:
bootstrapServers: <string> # required
topic: <string> # required
'$ref': <string>
acks: <string>
batchSize: <int>
clientId: <string>
compressionType: <string>
deliveryTimeoutMs: <int>
enableIdempotence: <boolean>
key: <string>
language: groovy
lingerMs: <int>
maxRequestSize: <int>
requestTimeoutMs: <int>
saslJaasConfig: <string>
saslMechanism: <string>
securityProtocol: <string>
xmlConfig: {}
kafkaProducer:
bootstrapServers: <string> # required
topic: <string> # required
'$ref': <string>
acks: <string>
batchSize: <int>
clientId: <string>
compressionType: <string>
deliveryTimeoutMs: <int>
enableIdempotence: <boolean>
key: <string>
language: groovy
lingerMs: <int>
maxRequestSize: <int>
requestTimeoutMs: <int>
saslJaasConfig: <string>
saslMechanism: <string>
securityProtocol: <string>
xmlConfig: {}
Attributes
| Name | Required | Default | Description | Examples |
|---|---|---|---|---|
| $ref | false | - | Reference a component defined under components. | - |
| acks | false | all | Number of brokers that must acknowledge a message before it counts as sent. | 0 | 1 | all |
| batchSize | false | 16384 | Maximum size of a batch of messages in bytes. | - |
| bootstrapServers | true | - | Comma separated list of Kafka brokers used for the initial connection. | kafka1.example.com:9092,kafka2.example.com:9092 |
| clientId | false | - | Client id sent to the brokers, useful for logging and quotas on the Kafka side. | membrane |
| compressionType | false | none | Compression of the message batches. | none | gzip | snappy | lz4 | zstd |
| deliveryTimeoutMs | false | 120000 | Upper bound in milliseconds for reporting success or failure of a send, including retries. | - |
| enableIdempotence | false | true | Prevents duplicate messages when the producer retries. Requires acks=all. | - |
| key | false | - | Expression computing the record key. The key determines the partition. Without a key Kafka distributes the messages over the partitions. | headers['X-Order-Id'] |
| language | false | SpEL | Scripting language used to evaluate the value expression. | SpEL | groovy | jsonpath | xpath |
| lingerMs | false | 0 | Time in milliseconds to wait for more messages before a batch is sent. | - |
| maxRequestSize | false | 1048576 | Maximum size of a single message in bytes. | - |
| requestTimeoutMs | false | 30000 | Time in milliseconds to wait for the answer of a broker. | - |
| saslJaasConfig | false | - | JAAS login configuration for SASL authentication. | org.apache.kafka.common.security.plain.PlainLoginModule required username="user" password="secret"; |
| saslMechanism | false | - | SASL mechanism for authentication, used with the security protocols SASL_PLAINTEXT and SASL_SSL. | PLAIN | SCRAM-SHA-256 | SCRAM-SHA-512 |
| securityProtocol | false | - | Protocol used to talk to the brokers. Kafka default is PLAINTEXT. | PLAINTEXT | SSL | SASL_PLAINTEXT | SASL_SSL |
| topic | true | - | Topic the messages are sent to. | orders |
Child Structure
| Element | Cardinality | Description |
|---|---|---|
| xmlConfig | 0..1 | XML namespace declarations for XPath expressions in the value. |