TsgcWSPClient_KafkaMethods › ProduceBytes

ProduceBytes Method

Publishes a binary (TBytes) record to a topic.

Syntax

procedure ProduceBytes(const aTopic: string; const aValue: TBytes; const aKey: TBytes; aPartition: Integer = -1);

Parameters

Remarks

Sends a single binary record to the broker. Use this method when the value or key is not a string, for example serialized data, compressed payloads or protocol buffers. For text payloads Produce is more convenient, and ProduceMessages sends a batch of records in one request.

Example

var
  vValue, vKey: TBytes;
begin
  vValue := TEncoding.UTF8.GetBytes('Hello Kafka');
  vKey := TEncoding.UTF8.GetBytes('key-1');
  oKafka.ProduceBytes('my-topic', vValue, vKey);
end;

Back to Methods