How it works...

This recipe demonstrates passing simple messages via Kafka. More complex methods should use a serialization format such as json, gob, protobuf, or others. The producer can send a message to Kafka synchronously through sendMessage. This does not handle cases well where the Kafka cluster is down, and may result in a hung process for these cases. This is important to consider for applications such as web handlers, as it may result in timeouts and hard dependencies on the Kafka cluster.

Assuming the message queues correctly, our consumer will observe the Kafka stream and do something with the results. Previous recipes in this chapter might make use of this stream to do some additional processing.