-
Notifications
You must be signed in to change notification settings - Fork 24
Communicator Settings
Communicator implmentations are based on exist message oriented middleware, mithqtt nodes (broker and http) pass internal messages to each other through communicator, and user application consume MQTT event from communicator. Communicator is designed to be pluggable, currently we provide Hazelcast, RabbitMQ, Kafka based implementations, but user can also write his own implementation fulfill Communicator Api.
The idea is choosing the communicator implementation based on its underlying features, let's say whether you want to use Hazelcast, RabbitMQ, Kafka. We will briefly go through each implementation below, but we suggest reading theirs official docuements.
Hazelcast is an in-memory data grid which offers lots of features. Our communicator implementation only uses the RingBuffer. Hazelcast communicator is the default communicator implementation.
Advantage: Hazelcast communicator is self contained, no 3rd party server needed, simplely up and running.
Disadvantage: When initializing hazelcast communicator will try to read from RingBuffer at its last position. The default HazelcastApplicationCommunicator for user application, when recovers from failure, may missed some mqtt messages. To overcome this, user have to write his own client with more complicated logic (like saving the reader index somethere).
Mithqtt broker, http, application use the communicator.properties file to configure communicator. Rename the sample configuration file communicator.hazelcast.properties to communicator.properties and update the required settings:
The implementation class name for broker should be HazelcastBrokerCommunicator.
The implementation class name for http should be HazelcastHttpCommunicator.
The implementation class name for application should be HazelcastApplicationCommunicator. (Or write your own client based on official hazelcast client)
# Communicator implementation (full qualified class name)
communicator.class = com.github.longkerdandy.mithqtt.communicator.hazelcast.broker.HazelcastBrokerCommunicator