TsgcWSPClient_KafkaMethods › Poll

Poll Method

Fetches available records, waiting up to a timeout.

Syntax

function Poll(aTimeoutMs: Integer = 1000): TsgcKafkaMessages;

Parameters

Remarks

Fetches the records currently available for the subscribed topics, waiting up to aTimeoutMs milliseconds if none are ready. The records are returned as a TsgcKafkaMessages list and the OnKafkaMessage event is also raised once per record. The caller owns the returned object and must free it. Call Poll repeatedly in a loop to keep consuming.

Example

var
  oMessages: TsgcKafkaMessages;
  i: Integer;
begin
  oMessages := oKafka.Poll(1000);
  try
    for i := 0 to oMessages.Count - 1 do
      ShowMessage(oMessages.GetValueString(i));
  finally
    oMessages.Free;
  end;
end;

Back to Methods