JDBC Driver for Apache Kafka

Build 23.0.8839

ProduceMessage

Sends a raw message to Kafka.

Minimum Required Inputs

Only the Topic input must be set when producing a message:

EXEC ProduceMessage Topic = 'mytopic'

The rest of the properties have these default behaviors:

  • Partition: the native library determines the partition automatically, taking into account any relevant options from ProducerProperties.
  • KeyText and KeyBytes: if neither of these is given, the 本製品 produces a message without a key.
  • MessageText and MessageBytes: if neither of these is given, the 本製品 produces a message without any content.

Omitting the key or message content may make the message unreadable with certain 本製品 settings. For example, setting MessageKeyType to integer may cause read failures with messages that have no keys. TypeDetectionScheme MessageOnly and MessageKeyType Binary are recommended if you need to read messages containing arbitrary content or keys.

KeyText/KeyBytes and MessageText/MessageBytes

The key and message can each be provided either as text or base64-encoded strings. KeyBytes and MessageBytes accept base64-encoded strings. The 本製品 decodes these values into bytes before sending the message to Kafka.

KeyText and MessageText accept any text. The 本製品 encodes these values as UTF-8 before sending the message to Kafka.

For example, this statement inserts a message with no key and content that is a single NUL byte:

EXEC ProduceMessage Topic = 'mytopic', MessageBytes = 'AA=='

Input

Name Type Required Description
Topic String True The topic that contains the message.
Partition String False The partition the message is assigned to. Must be valid for the given topic. Automatically assigned by the native client if not set.
KeyText String False The message given as text. The value is encoded as UTF-8 before being sent to Kafka. Do not set if KeyBytes is given.
KeyBytes String False The message key given as a base64 encoded string. Do not set if KeyText is given.
MessageText String False The message key given as text. The value is encoded as UTF-8 before being sent to Kafka. Do not set if MessageBytes is given.
MessageBytes String False The message value given as a base64 encoded string. Do not set if MessageText is given.

Result Set Columns

Name Type Description
PartitionWritten Int The partition that the message was written to. Is the same as Partition if that parameter is given.
OffsetWritten Long The position in the partition that the message was written to.
TimestampWritten Long The Unix timestamp of the instant the message was committed to the partition.
KeyWritten String The base64 data of the key that was written. Is NULL if neither Key nor KeyBytes was provided.
MessageWritten String The base64 data of the value that was written. Is NULL if neither Message nor MessageBytes was provided.
Success Bool Whether the operation was successful.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839