X4 Produktdokumentation

Apache Kafka Publisher

The adapter enables you to publish messages in a specific Apache Kafka Topic.

Properties

Operation

Defines the operation executed by the adapter.

Possible values:

  • Publish: Publishes a message in a specific topic that is specified in an XML input.

Parameters

trustStorePath

Defines where the trust store to be used is located.

trustStorePassword

Password for the trust store

keyStorePath

Defines where the key store to be used is located.

keystorePassword

Password for the key store

privateKeyPassword

Password of the private key in the keystore file

username

User name for SASL/PLAIN authentication at the Kafka server

If you use this parameter, the configuration properties sasl.mechanism = PLAIN and security.protocol = SASL_SSL are set.

password

Password for SASL/PLAIN authentication at the Kafka server

If you use this parameter, the configuration properties sasl.mechanism = PLAIN and security.protocol = SASL_SSL are set.

clusterId

ID of the cluster in which the message is published

Possible values: Cluster ID

The ID of the cluster can be found in the file apachekafka-config.xml. It is located in the id attribute of the Cluster element.

ClientId

ID of the client with which the message is published

Possible values: Client ID

The ID of the cliente can be found in the file apachekafka-config.xml. It is located in the id attribute of the Client element.

topic

Name of the topic in which the message is published

Possible values: String consisting of alphanumeric ASCII characters, . (dot), _ (underscore) and - (hyphen)

messageDataType

Data type of the message(s) to be published.

Possible values:

  • BYTES: Base64 encoded value

  • BYTEARRAY: Base64 encoded value

  • DOUBLE: Floating-point number

  • FLOAT: Floating-point number

  • INTEGER: Integer

  • LONG: Integer

  • SHORT: Integer

  • STRING (default): String

  • UUID: Java UUID


Messages with different data types can be published in a topic. To read the messages with the Apache Kafka Subscriber Adapter, the data type must be known and set correctly. For example, a message of the data type STRING cannot be read with the data type setting LONG. Therefore, all messages in a topic should be of the same data type.

keyDataType

Data type of the key

Possible values:

  • NONE (default): This value is used if no key is defined.

  • BYTES: Base64 encoded value

  • BYTEARRAY: Base64 encoded value

  • DOUBLE: Floating-point number

  • FLOAT: Floating-point number

  • INTEGER: Integer

  • LONG: Integer

  • SHORT: Integer

  • STRING (default): String

  • UUID: Java UUID

Sample key definition
XML
<Messages>
    <Message key="055b93a8-4eda-41d8-8b73-b852a1d4da1e">055b93a8-4eda-41d8-8b73-b852a1d4da1e</Message>
</Messages>

The following four cases can be distinguished:

  • A key with a data type other than NONE has been defined: The message is sent with a key in the specified data type.

  • A key with the NONE data type has been defined: The message is sent without a key and a warning is issued in the server log.

  • No key has been defined and the data type of the key has a value other than NONE: The message will not be sent and an error message will be issued.

  • No key has been defined and the data type of the key is NONE: The message will be sent without a key.

The values of the trustStorePath, trustStorePassword, keyStorePath, keyStorePassword and privateKeyPassword parameters can also be defined in the apachekafka-config.xml file (see (7.5.0-en) Apache Kafka).

The information about the adapter configuration overwrites the information in the apachekafka-config.xml. However, all parameters must be set for this. If not all parameters are set via the adapter configuration, the files from the apachekafka-config.xml are used.

If adapter parameters are used to override the SSL configuration of a particular client, then these values are retained until they are overridden again or the server is restarted.


Status values

1

The adapter operation was executed successfully.

-1

An error occurred during the execution of the adapter.