Last month was full of important moments

Last month or so was really excited and full of different and important moments.

First of all, I become a father, my son was born 12 May, he is just amazing.

What else, well there was a chain of conferences/meetups I was speaking at and here are some links :

Sample #Kafka producer with #Groovy

Here is a brief example of Kafka producer client written in Groovy:

import org.apache.kafka.clients.producer.Callback
import org.apache.kafka.clients.producer.KafkaProducer
import org.apache.kafka.clients.producer.ProducerRecord
import org.apache.kafka.clients.producer.RecordMetadata
@Grab(group = "org.apache.kafka", module = "kafka-clients", version = "")
@Grab(group = 'ch.qos.logback', module = 'logback-classic', version = '1.1.2')
Properties props = new Properties()
props.put('zk.connect', '')
props.put('bootstrap.servers', ',,')
props.put('key.serializer', 'org.apache.kafka.common.serialization.StringSerializer')
props.put('value.serializer', 'org.apache.kafka.common.serialization.StringSerializer')
def producer = new KafkaProducer(props)
def messageSender = { String topic, String message ->
    String key = new Random().nextLong()
    String compoundMessage = "key: $key, message: $message"
            new ProducerRecord<String, String>(topic, key, compoundMessage),
            { RecordMetadata metadata, Exception e ->
                println "The offset of the record we just sent is: ${metadata.offset()}"
            } as Callback
args.each { arg ->
    println "sending message $arg"
    messageSender('simple.topic', arg)

In order to run it use:

groovy producer.groovy hello from Groovy client