class Kafka::Producer
- Kafka::Producer
- Reference
- Object
Overview
represents a kafka producer
Defined in:
kafka/producer.crConstructors
-
.new(conf : Config)
creates a new kafka handle using provided config.
Instance Method Summary
- #flush(timeout_ms : Int32)
-
#polling : Bool
returns true if polling fiber is running
-
#produce(msg : String, partition : Int32 = LibKafkaC::PARTITION_UNASSIGNED, key : String | Nil = nil, flags : Int32 = LibKafkaC::MSG_FLAG_COPY)
enqueues msg Will start internal polling fiber, if not already started.
-
#set_topic(name : String)
Set the topic to use for produce() calls.
-
#stop
Calls flush(1000) and will stop polling fiber, if running.
Constructor Detail
creates a new kafka handle using provided config. Throws exception on error
Instance Method Detail
def produce(msg : String, partition : Int32 = LibKafkaC::PARTITION_UNASSIGNED, key : String | Nil = nil, flags : Int32 = LibKafkaC::MSG_FLAG_COPY)
#
enqueues msg Will start internal polling fiber, if not already started. returns true on success. Raises exception otherwise