Clients -
kafka :
Producer
Represent a Kafka producer endpoint.
Constructor
__init
(ProducerConfig config)
- config ProducerConfig
-
Configurations related to initializing a Kafka
Producer.
Remote Methods
| close | Closes producer connection to the external Kafka broker. |
| commitConsumer | Commits consumer action which commits consumer consumed offsets to offset topic. |
| commitConsumerOffsets | CommitConsumerOffsets action which commits consumer offsets in given transaction. |
| flushRecords | Flush action which flush batch of records. |
| getTopicPartitions | GetTopicPartitions action which returns given topic partition information. |
| send | Simple Send action which produce records to Kafka server. |
Fields
- producerConfig ProducerConfig? (default ())
-
Used to store configurations related to a Kafka connection.
- connectorId string (default system:uuid())
-
Unique ID for a particular connector.
Closes producer connection to the external Kafka broker.
-
Return Type
(ProducerError?) kafka:ProducerErrorif closing the producer failed, nil otherwise.
Commits consumer action which commits consumer consumed offsets to offset topic.
Parameters
- consumer Consumer
-
Consumer which needs offsets to be committed.
-
Return Type
(ProducerError?) kafka:ProducerErrorif committing the consumer failed, nil otherwise.
CommitConsumerOffsets action which commits consumer offsets in given transaction.
Parameters
- offsets PartitionOffset[]
-
Consumer offsets to commit for given transaction.
- groupID string
-
Consumer group id.
-
Return Type
(ProducerError?) kafka:ProducerErrorif committing consumer offsets failed, nil otherwise.
Flush action which flush batch of records.
-
Return Type
(ProducerError?) kafka:ProducerErrorif records couldn't be flushed, nil otherwise.
GetTopicPartitions action which returns given topic partition information.
Parameters
- topic string
-
Topic which the partition information is given.
-
Return Type
(TopicPartition[] | ProducerError) kafka:TopicPartitionarray for the given topic, returnskafka:ProducerErrorif operation fails.
send
(byte[] value, string topic, byte[]? key, int? partition, int? timestamp)
returns ProducerError?Simple Send action which produce records to Kafka server.
Parameters
- value byte[]
-
Record contents.
- topic string
-
Topic to which the record will be appended to.
- key byte[]? (default ())
-
Key that will be included in the record.
- partition int? (default ())
-
Partition to which the record should be sent.
- timestamp int? (default ())
-
Timestamp of the record, in milliseconds since epoch.
-
Return Type
(ProducerError?) Returns
kafka:ProducerErrorif send action fails to send data, nil otherwise.