Version 4 (modified by masc01, 10 years ago) (diff)


Configuring ActiveMQ

Communication in the SEMAINE API passes via ActiveMQ, an open-source message-oriented middleware which implements the Java Message Service (JMS) specification.

We use the publish-subscribe model of JMS for communicating, which is based on the notion of a Topic: components can publish (send) messages to a Topic or subscribe to the topic to receive messages sent to that Topic. In other words, it is a flexible mechanism for n-to-m communication. To establish a communication between two components, it is sufficient for them to use the same Topic name.

ActiveMQ uses a broker -- a messaging server to which all components connect. In previous versions of the SEMAINE API, the activemq server had to be started separately; as of SEMAINE-3.1, there is the option of creating an embedded broker as part of the java process. The main java config file provides a boolean property through which the use of an embedded broker can be switched on or off (see ConfiguringSEMAINE).

Connecting to an external ActiveMQ server

Let us first assume that activemq runs as a separate server. In that case, all components will connect to the activemq server via a URL. By default, the ActiveMQ server uses the "OpenWire" protocol (which for activemq is bound to the protocol prefix tcp:// and port 61616, so that a connection to an activemq server on the local machine corresponds to the URL:


This setting can be provided as a global setting to the SEMAINE API as follows:

For java:

java -Djms.url=tcp://localhost:61616 ...

For C++:

# for Mac / Linux:
export CMS_URL=tcp://localhost:61616

rem for Windows:
set CMS_URL=tcp://localhost:61616

Embedded ActiveMQ

If a SEMAINE java process is configured to run an embedded activemq server as part of the java process itself, the communication between the components in that process and the activemq server will be done in memory, which improves performance.

For all other components in the system, nothing changes: they will connect ot this embedded activemq broker in the same way as they connect to an external activemq broker.

Configuring ActiveMQ

All communication in the SEMAINE API passes via ActiveMQ. Since SEMAINE is a real-time system, it is essential to carefully configure ActiveMQ. For the embedded case, there is an ActiveMQ configuration file included in the java classpath: tags/3.1.0/java/src/eu/semaine/jms/activemq.xml. We also provide a reference config file to use (or start from) when running an external ActiveMQ server, in tags/3.1.0/docs/activemq.xml.