Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bidirectional messaging system using kafka

Is there any possible to develop a bi-directional messaging system using apache kafka ? I need to subscribe for a topic from my consumer as well as I need to send message from my consumer.

like image 587
Prasath Avatar asked Sep 22 '16 13:09

Prasath


People also ask

Is Kafka bidirectional?

Kafka has a "bidirectional" client compatibility policy. In other words, new clients can talk to old servers, and old clients can talk to new servers.

Can Kafka be used for messaging?

We can use Kafka as a Message Queue or a Messaging System but as a distributed streaming platform Kafka has several other usages for stream processing or storing data. We can use Apache Kafka as: Messaging System: a highly scalable, fault-tolerant and distributed Publish/Subscribe messaging system.

What are messaging systems Kafka?

What is Kafka? Apache Kafka is a distributed publish-subscribe messaging system and a robust queue that can handle a high volume of data and enables you to pass messages from one end-point to another. Kafka is suitable for both offline and online message consumption.

Can we use Kafka for Microservice communication?

Why is Kafka the first choice for Microservices? Apache Kafka was designed to solve issues of readability and scaling that holds back queues of older messages. Apache Kafka architecture for microservices utilizes an application setup where Microservices communicate with each other through Kafka.


1 Answers

You could do it one of two ways. Either set up a prefix system for the message keys or put content inside of the message that allows the consumer to avoid messages it has produced.

Now as to whether you should design it like this, that depends on your message traffic. If you're not slamming it with events, it might be better to consider something like Thrift as a way to have your message components do bidirectional communication. Where Kafka really excels relative to its complexity is when you need to produce and consume massive volumes of data. That might not be the case for you.

For example, one common use case with Kafka is to hook it up to a service like Storm, Apex or Samza for doing distributed processing of hundreds of GB or even TB of data. If your system has a high throughput requirement, that architecture would be a good one to consider as a starting point with Kafka for handling messages. With Storm, if you need to send messages back for reprocessing, you can always use the Kafka bolt to republish a message into Kafka to ensure it gets completely reprocessed.

like image 200
Mike Thomsen Avatar answered Oct 30 '22 16:10

Mike Thomsen