Book Image

Learning Karaf Cellar

By : Jean Baptiste Onofre, Jean-Baptiste Onofré
Book Image

Learning Karaf Cellar

By: Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (16 chapters)

Chapter 5. Producers, Consumers, Handlers, Listeners, and Synchronizers

In the previous chapters, we saw that Cellar exchanges cluster events between different nodes. This means that a node creates a cluster event and sends it to the other nodes. On the other hand, the other nodes receive the cluster events and update the local state with the statements contained in the cluster events.

Beneath the hood, a node acts as a cluster event producer. Cellar uses a Hazelcast queue to store and dispatch the cluster event to the other nodes. A producer sends a message that represents a cluster event to the queue.

The other nodes act as cluster event consumers. This means that they consume the cluster event from the queue. As the queue contains different cluster event types (a bundle event, a configuration event, a feature event, and an OBR event), the consumer delegates the handling of the event to a handler dedicated for each kind of cluster event. This process is shown in the following diagram: