Version 1 (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).

Separate ActiveMQ server

For the sake of simplicity, 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