TsgcWSPClient_Kafka › Methods › ProduceBytes
Publishes a binary (TBytes) record to a topic.
procedure ProduceBytes(const aTopic: string; const aValue: TBytes; const aKey: TBytes; aPartition: Integer = -1);
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.
var
vValue, vKey: TBytes;
begin
vValue := TEncoding.UTF8.GetBytes('Hello Kafka');
vKey := TEncoding.UTF8.GetBytes('key-1');
oKafka.ProduceBytes('my-topic', vValue, vKey);
end;