-
-
Notifications
You must be signed in to change notification settings - Fork 9
Broker
A message broker is software that enables applications, systems, and services to communicate with each other and exchange information. These applications, systems or services send or receive messages to queues or topics.
A queue is sequence of messages. Those messages can be received by only one consumer. In a topic every consumer (subscriber) receives a copy of the message. The broker manages those queues and topics.
A broker gateway means that the broker acts as gateway for a specific application. Several applications can send or receive messages to the broker while the application uses the broker as a gateway.
Assimbly can run brokers embedded. This means applications can send or receive messages directly to the broker on Assimbly or use an Assimbly flow to get or put messages on the broker.
A broker has several advantages.
- Transport layer. An application only needs to implement this protocol and don't care about others. There is a single layer of transport. Applications don't need to be connected directly, but use the broker as intermediary layer.
- Delivery guarantees: Messages are transported in a reliable way. With for example file systems or FTP a message can be deleted from the file system or locked by the file system.
- Scaling: Brokers normally scale well even though data volumes changes.
- Buffering: In case of high volumes it buffers messages, so that consumers don't need to scaled for peak volumes.
- Security: Control the way systems/users can send or receive messages.
See also: message-queues-12-reasons
Assimbly supports two brokers: ActiveMQ Classic and ActiveMQ Artemis. Both are supported well in Assimbly flows. Use ActiveMQ if you need a stable and well documented broker. Use Artemis if performance and cloud are more important. Artemis is expected to become the new version of ActiveMQ and used by default in Assimbly.
To enable the brokers
- Navigate to "Settings --> Gateway"
- Click on edit and choose "Broker" (ActiveMQ Classic) or "Artemis" (ActiveMQ Artemis). The broker now start automatically.
- To send messages to the broker create a new flow and use the ActiveMQ component. For Artemis use the SJMS component.
To view messages on the broker you can use "Queues" or "Topics" page. You can also use JMSToolbox. This is a universal broker client.
By default Assimbly starts with a simple broker configuration that is reachable on "tcp://localhost:61616". There is no security enabled, you can immediately send or receive messages. When sending messages queues or topics are automatically created.
You can create an Assimbly flow to act as a client and send/receive messages from queues. Example is done in the following tutorial.
It's also possible to use an external client. A common client is JMSToolbox, a universal JMS client. It can be used to view queues and send messages to it. To use it:
- Download: https://github.com/jmstoolbox/jmstoolbox/releases
- Unzip the file and start JMSToolbox
- Go to File --> New Session
- Create a new connection with same parameters as used in Asssimbly
Save the connection
By double-clicking on the name it will connect to the broker.
To create a configuration for production use, you need to add a configuration file to the application directory (where the jar starts).
- The configuration file for the default broker is "activemq.xml". An example is here:
https://github.com/assimbly/gateway/blob/master/activemq.xml
Complete reference is on the ActiveMQ website:
https://activemq.apache.org/version-5-xml-configuration.html
- The configuration file for Artemis is "broker.xml". An example is here:
https://github.com/assimbly/gateway/blob/master/broker.xml
Complete reference is on the ActiveMQ website:
https://activemq.apache.org/components/artemis/documentation/latest/configuration-index.html
Mostly on production the broker has several nodes. Together these nodes form a cluster. Read more: