# \[project\] ActiveMQ Integration

**URL:** <https://forum.inductiveautomation.com/t/project-activemq-integration/15535>\
**Category:** Ignition\
**Created:** [October 2, 2017, 1:39pm UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535 "2017-10-02T13:39:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [October 2, 2017, 1:39pm UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/1 "2017-10-02T13:39:10Z")

</div>

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](https://pastebin.com/cwW59zPR))

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

3. Establish a connection with your broker.

## Ignition Project

1. (PRE-REQ) Install Nick's Database Module. ([Database Module](http://www.perfectabstractions.com/database-module.html))

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](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.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b8b7ed5df1da89f087eedbd28a16380302c77c56.png)

_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`).

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/40f5e3f624c079215e4864150f930deff6915e06.png)  
**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](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b22eeae57f7d88e3c911d45ddfbf9d6a2fba4f71.proj) (4.0 KB)  
[ActiveMQIntegration-project-latest.proj](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/d0aa74b2a87ca5401bb8acfe905880a6e0225819.proj) (30.3 KB)

---

<div class="post-metadata">

**Author:** ![dmdrendall](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dmdrendall](https://forum.inductiveautomation.com/u/dmdrendall)\
**Post date:** [November 20, 2017, 10:39pm UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/5 "2017-11-20T22:39:08Z")

</div>

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](http://www.omg.org/events/tm-resource-hub/brussels-17/MARS.pdf)

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [November 27, 2017, 2:56pm UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/6 "2017-11-27T14:56:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmdrendall](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dmdrendall](https://forum.inductiveautomation.com/u/dmdrendall)\
**Post date:** [December 14, 2017, 1:48pm UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/7 "2017-12-14T13:48:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [April 30, 2018, 2:56am UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/8 "2018-04-30T02:56:26Z")

</div>

Here is an update.

inbound  
[http://recordit.co/PFDz9ObMsR](http://recordit.co/PFDz9ObMsR)

outbound  
[http://recordit.co/1IQLCetu9s](http://recordit.co/1IQLCetu9s)

---

<div class="post-metadata">

**Author:** ![yao.hu](https://avatars.discourse-cdn.com/v4/letter/y/e5b9ba/32.png) [@yao.hu](https://forum.inductiveautomation.com/u/yao.hu)\
**Post date:** [April 25, 2019, 9:35am UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/9 "2019-04-25T09:35:24Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [April 30, 2019, 3:23am UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/10 "2019-04-30T03:23:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gabhainn.mairtin](https://avatars.discourse-cdn.com/v4/letter/g/e47774/32.png) [@gabhainn.mairtin](https://forum.inductiveautomation.com/u/gabhainn.mairtin)\
**Post date:** [March 25, 2020, 8:09pm UTC](https://forum.inductiveautomation.com/t/project-activemq-integration/15535/11 "2020-03-25T20:09:11Z")

</div>

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?
