Skip to content

Instantly share code, notes, and snippets.

@mutability
Last active August 29, 2015 14:26
Show Gist options
  • Save mutability/83b5f59566eb3a73356f to your computer and use it in GitHub Desktop.
Save mutability/83b5f59566eb3a73356f to your computer and use it in GitHub Desktop.
try to provoke delivery reports from kafkatcl
package require kafka
proc the_delivery_callback {message} {
puts stderr "delivery callback: $message"
set ::die 1
}
proc the_error_callback {message} {
puts stderr "error callback: $message"
set ::die 1
}
::kafka::setup_producer -brokers hekri
::kafka::master delivery_report callback the_delivery_callback
::kafka::master delivery_report every 1
::kafka::master error_callback the_error_callback
::kafka::master logger stderr
::kafka::producer config request.required.acks 1
::kafka::producer config request.timeout.ms 5000
::kafka::producer config message.timeout.ms 10000
::kafka::topic_producer adept_commands adept.commands
puts stderr "master config:"
foreach {k v} [::kafka::master config] {
puts stderr " $k=$v"
}
puts stderr "producer config:"
foreach {k v} [::kafka::producer config] {
puts stderr " $k=$v"
}
puts stderr "Producing a message.."
adept_commands produce 0 "this is the payload"
puts stderr "waiting for delivery or error.."
vwait ::die
puts stderr "all done"
#$ tclsh ./produce.tcl
#master config:
# client.id=rdkafka
# message.max.bytes=4000000
# receive.message.max.bytes=100000000
# metadata.request.timeout.ms=60000
# topic.metadata.refresh.interval.ms=10000
# topic.metadata.refresh.fast.cnt=10
# topic.metadata.refresh.fast.interval.ms=250
# topic.metadata.refresh.sparse=false
# socket.timeout.ms=60000
# socket.send.buffer.bytes=0
# socket.receive.buffer.bytes=0
# socket.keepalive.enable=false
# socket.max.fails=3
# broker.address.ttl=300000
# broker.address.family=any
# statistics.interval.ms=0
# error_cb=0x8015c4a90
# log_cb=0x802004850
# log_level=6
# socket_cb=0x802009670
# open_cb=0x8020180a0
# opaque=0x801e6f490
# internal.termination.signal=0
# queued.min.messages=100000
# queued.max.messages.kbytes=1000000
# fetch.wait.max.ms=100
# fetch.message.max.bytes=1048576
# fetch.min.bytes=1
# fetch.error.backoff.ms=500
# queue.buffering.max.messages=100000
# queue.buffering.max.ms=1000
# message.send.max.retries=2
# retry.backoff.ms=100
# compression.codec=none
# batch.num.messages=1000
# delivery.report.only.error=false
# dr_msg_cb=0x8015c4bd0
#producer config:
# request.required.acks=1
# enforce.isr.cnt=0
# request.timeout.ms=5000
# message.timeout.ms=10000
# produce.offset.report=false
# opaque=0x801e6f490
# auto.commit.enable=true
# auto.commit.interval.ms=60000
# auto.offset.reset=largest
# offset.store.path=.
# offset.store.sync.interval.ms=-1
# offset.store.method=file
# consume.callback.max.messages=0
#Producing a message..
#waiting for delivery or error..
# (hangs indefinitely)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment