This page explains the Apache Kafka Producer Adapter in Bridge context. If you were looking for the same information regarding the PAS Designer, refer to Apache Kafka Producer Adapter in the Designer guide.

You can use the Apache Kafka Producer Adapter to write synchronous messages to an Apache Kafka event topic. The access to Kafka can be configured statically by an alias - dynamic access is not available. The Kafka Producer supports SSL but no Kerberos authentication.

To use the Apache Kafka Producer adapter, you need basic knowledge of Apache Kafka. Refer to the Apache Kafka Documentation for any deeper insights.

Writing a Message to a Kafka Topic

You can use the Apache Kafka Producer adapter to write a message to a Kafka topic. Create an action node and assign stereotype KafkaProducerAdapter. This action node has got the following parameters:

 Name Type Direction Description
producerRecord ProducerRecord in Provide the message and the target for the adapter to send the message to a Kafka topic.
recordMetaData RecordMetaData out Returns some meta data about the processing the Kafka broker has done.

producerRecord is a complex structure that defines the message and target.The topic you want to write the message to is the only mandatory parameter.

Attribute Type Mandatory Description
topic String (tick) Specify the topic the message should be sent do.
partition
Integer (error) Specify the partition the message should be send to.
key
Blob (error) Specify a key the message should be filed to.
id
Integer (error) Will be generated. We recommend not to set one manually.
headers
Array of MessageHeader (error) Specify headers if you want to provide additional information on the  message content for e.g. routing or filtering use cases.
value
Blob (error) Specify the actual message content. Only payload of type Blob is supported.

The Kafka Producer returns some meta data about the processing of the message.

Attribute Type Mandatory Description Allowed Values / Examples
topic String (tick) Kafka topic the message has been sent to.
partition
Integer (tick) Topic partition the message has been sent to.
offset
Integer (error) Offset of the message within the partition.
recordId
Integer (error) The message ID as provided with the call, or as generated if it has not been specified.
keySize
Integer (tick) Actual size of the key in bytes.
valueSize
Integer (tick) Actual size of the value in bytes.
timestamp
DateTime (error) A processing timestamp (UTC). See timestampType for what the timestamp refers to.
timestampType


TimestampType (tick) Indicates what the timestamp refers to. NotAvailable Timestamp is unknown.
CreateTime Timestamp relates to message creation time as set by a Kafka broker.
LogAppendTime Timestamp relates to the time a message was appended to a Kafka log.
persistedStatus


PersistedStatus (tick) Status of the message. NotPersisted Message was never transmitted to the broker, or failed with an error indicating it was not written to the log.
Persisted Message was written to the log and acknowledged by the broker.
PossiblyPersisted Message was transmitted to broker, but no acknowledgement was received.

Transaction Handling

The xUML Runtime handles Apache Kafka Producer calls like is specified in the Runtime transaction concept. All producer calls within a session are wrapped into a dedicated transaction with a random unique transaction ID. These transactions can be rolled back until they have been committed.
You cannot set a custom transaction ID (transactional.id), therefore there will be no fencing.

On this Page:
Related Documentation:
  • No labels