user432024
user432024

Reputation: 4665

How to join multiple Kafka topics?

So I have...

So a single logical business request can have multiple logs, commands and events associated to it by a uuid which the microservices pass to each other.

So what are some of the technologies/patterns that can be used to read the 3 topics and join them all together as a single json document and then dump them to lets say Elasticsearch?

Streaming?

Upvotes: 7

Views: 21579

Answers (3)

Zamir Arif
Zamir Arif

Reputation: 341

You can use KSQL to join the streams.

  1. There are 2 constructs in KSQL Table/Stream.
  2. Currently, the Join is supported for a Stream & a table. So you need to identify the which is a good fit for what?
  3. You don't need windowing for joins.

Benefits of using KSQL.

  1. KSQL is easy to set up.
  2. KSQL is SQL language which helps you to query your data quickly.

Drawback.

  1. It's not production ready but in April-2018 the release is coming up.
  2. Its little buggy right now but certainly will improve in a few months.

Please have a look.

https://github.com/confluentinc/ksql

Upvotes: 3

Robin Moffatt
Robin Moffatt

Reputation: 32050

You can use Kafka Streams, or KSQL, to achieve this. Which one depends on your preference/experience with Java, and also the specifics of the joins you want to do.

KSQL is the SQL streaming engine for Apache Kafka, and with SQL alone you can declare stream processing applications against Kafka topics. You can filter, enrich, and aggregate topics. Currently only stream-table joins are supported. You can see an example in this article here

The Kafka Streams API is part of Apache Kafka, and a Java library that you can use to do stream processing of data in Apache Kafka. It is actually what KSQL is built on, and supports greater flexibility of processing, including stream-stream joins.

Upvotes: 9

Related Questions