The publish/subscribe model of Kafkorama works as follows:
When a new subscriber connects to a Kafkorama Gateway within a Kafkorama cluster and subscribes to a subject — for
example, /mytopic/mykey
— the server first sends a snapshot message for that subject,
if one exists. After that, any real-time messages published to the same subject — whether from a publisher or from Kafka
— are immediately delivered to the subscriber by the Kafkorama Gateway.
When the client is no longer interested in receiving messages for the subject /mytopic/mykey
, it can unsubscribe from
that subject.
Kafkorama enables publishers and subscribers to remain loosely coupled. The only element they share is the use of subjects, which are inherently abstract. As a result, publishers and subscribers can operate independently, without needing to know about each other.
Kafkorama Gateway uses Kafka’s client library to establish a TCP connection to a Kafka broker, based on the Kafka cluster configuration defined in the Kafkorama Portal. It subscribes to the Kafka topics that have been explicitly exposed in the portal.
An application built with one of the Kafkorama SDKs connects to the Kafkorama Gateway over a persistent WebSocket connection and can subscribe to one or more Kafkorama subjects.
If a Kafka topic T
is exposed in the Kafkorama Portal, any message M
received from a Kafka
producer on topic T
with key k
is consumed by the Kafkorama Gateway. The Gateway then delivers
the message M
to all application users subscribed to the Kafkorama subject /T/k
.
For example, in the diagram above, Kafka topics A
and B
have been exposed through the
Kafkorama Portal, so the Gateway is subscribed to them. When Kafka receives a message M
on topic
A
with key k1
, the Gateway consumes it and delivers it to all clients subscribed to the
subject /A/k1
.
For more details on how Kafkorama subjects map to Kafka topics, refer to the section Kafkorama Subjects ↔ Kafka Topics.
Kafkorama Gateway uses Kafka’s client library to establish a TCP connection to a Kafka broker, based on the Kafka cluster configuration defined in the Kafkorama Portal.
An application built with one of the Kafkorama SDKs connects to the Kafkorama Gateway via WebSocket and can publish real-time messages to one or more Kafkorama subjects.
When the Gateway receives a message M
with subject /T/k
from a publisher, it forwards the
message to Kafka on topic T
, using k
as the message key.
For more details on how Kafkorama subjects map to Kafka topics, refer to the section Kafkorama Subjects ↔ Kafka Topics.