[project] ActiveMQ Integration

JMS Messaging Support for Ignition Projects


Configure Messaging Broker

  1. Install ActiveMQ on a server and configure it. (INSTALLATION and CONFIGURATION 1. Install latest Java x64 JRE 2. Down - Pastebin.com)

  2. Get an MQTT client. (http://mqttfx.jensd.de/)

  3. Establish a connection with your broker.

Ignition Project

  1. (PRE-REQ) Install Nick's Database Module. (Database Module)

  2. Import attached project.

Gateway Startup

Turn up logging for 'activemq' logger.
A couple things happen on the first strartup of the project:

  • The latest activemq-all.jar is downloaded from Maven to %IGNITION_INSTALL%/lib/core/gateway/activemq-all-latest.jar.
    The JAR is manually added to JAVA paths upon download. Once Ignition services are restarted,
    the JAR is automatically loaded along with everything else in /lib/core/gateway.
    (https://mvnrepository.com/artifact/org.apache.activemq/activemq-all)

  • Tables are created in 'DefaultH2' data source. You will get an error in the gateway logs if this datasource is not found.

TABLES
activemq_connections: Your ActiveMQ connection strings and connection wide configuration.
activemq_subscriptiontopics: ActiveMQ topics that you will be subscribing to. Each topic can have a custom MessageListener. Leaving the column NULL will default to the generic listener (eg. project.activemq.AMQMessageListenerScript.AMQMessageListener). Custom message listeners can be added to shared.activemq.message_listeners package (eg. shared.activemq.message_listeners.CustomMessageListenerScript.CustomMessageListener).

activemq_connectionsubscriptionlinks: Here is where you tell each connection what topics it should subscribe to. Joins connection Id to topic Id.
activemq_projectsubscriptionlinks: Here is where you allow a message received on a specific topic to be passed through to a project client message handler. Joins topic id to an Ignition project name. The project must have an OnActiveMqMessage client message handler. Your custom MessageListener overrides this functionality.

During Gateway startup script execution, each connection is established and all enabled topics are subscribed to. Reconnections and resubscriptions are handled automatically.

Publishing Messages from Ignition

shared.activemq.publisher.publishToConnectionId(connectionId,topicPath,message={})
shared.activemq.publisher.publishToConnectionName(connectionName,topicPath,message={})

TODO: automatic update facility for activemq-all.jar.

TODO: allow custom javax.jms.ExceptionListener

TODO: allow custom org.apache.activemq.transport.TransportListener

TODO: USE_CASE_SPECIFIC create memory tags from KV pairs and update value on message received

TODO: USE_CASE_SPECIFIC create com.inductiveautomation.ignition.common.sqltags.model.event.TagChangeListener and publish to ActiveMQ on memory tag value change

TODO: build client interface for managing connections

TODO: advisory/control layer between client and gateway

ActiveMQIntegration-global-latest.proj (4.0 KB)
ActiveMQIntegration-project-latest.proj (30.3 KB)

1 Like

Hi Chris. Any word on the street whether OPC Foundation and the Object Management Group will merge their standards, thereby implementing a data or field messaging bus (OpenFMB) within OPC-UA? OMG’s DDS is used in military, and other situational awareness applications. It emphasizes a stateful way of being for all components on the data bus.

TC Meeting at OMG

I have not heard, but would that be necessary since both specifications are building support for AMQP, MQTT, etc?

I was looking at DDS as a WAN closed loop control protocol. Looks like a wrapper of translator to make an OPC-UA server capable of being a node on DDS.

Here is an update.

inbound
http://recordit.co/PFDz9ObMsR

outbound
http://recordit.co/1IQLCetu9s

thanks for sharing, just tried your example, but the connection between Ignition and broker can’t be established.
this error occured:
“javax.jms.JMSException: Cannot send, channel has already failed: tcp://127.0.0.1:1883”

Hey. You have to talk to the native JMS port 61616. ActiveMQ routes the messages to other connected clients, regardless of the protocol.

are the project files complete, or the correct version? There seem to be windows missing, at least comparing what’s on the videos with what’s in the project files? I know the thread is quite old, but this looks like a great example to learn from. The maven link for the activemq jar seems to have gone away, but after downloading activemq-all-5.15.12.jar by hand to …/lib/core/gateway/activemq-all-latest.jar it does start up, create the H2 schema objects, but that’s as far as I get … attempting to create/save a connection definition results in the UI doing nothing. (checked the project file itself: only the main window is present in the definition. Shoud there be others for the subscription/topic and connection management as shown in the videos?