2021.1.1124.2 Active MQ
Overview
As with all adapters, an existing 2021.1.1124.2 Logic Simulator | Overview is required.
Where to find the different Gateway Adapters.
Where to find
To find the Active MQ adapter, go to the Inspector window of a 2021.1.1124.2 Logic Simulator | Overview component.
This 2021.1.1124.2 Logic Simulator | Overview can be added under Logic.
Feature overview
Only the settings between the lines refer to the Active MQ Adapter.
Please check the documentation for the rest of the 2021.1.1124.2 Logic Simulator | Overview
Gateway settings |
|
---|---|
Adapter Target | Select a different adapter, please see respective documentation for more information |
Adapter Setting (MQTTServerSettings) |
|
XmlFilePath | File path to the policy file Warning : <Make sure to fill in a relative path to the Asset folder of the project and include .xml file extension> |
ServerName | Is used as the an indicator in the XML policy file |
IP Address | The address of the ActiveMQ server. This can be a be in IPv4 address or a hostname like localhost |
Port | The port on which the ActiveMQ broker is running, the default port is 61616. |
CorrelationID | The identifier on which a message responds. Different Correlation IDs can communicate over the same queue, but is not recommended. Make sure other clients use the same Correlation ID |
DeliveryMode | Int that defines whether the message is persistent(0) or non_persistent(1). Persistent is default and makes sure the message survives a broker reset. It can be a slower than non_persistent |
Lifecycle settings | Not implemented for Active MQ |
Prerequisites
ActiveMQ can work with an online broker on the internet, but is more commonly used with a local broker. A local broker can be downloaded from the Apache Website: https://activemq.apache.org/components/classic/download/
Java Runtime Environment is required. https://www.oracle.com/technetwork/java/javase/downloads/index.html
The README.txt in the zip file will help you setup the broker.
Once the broker is running you will find the broker admin page on http://localhost:8161/admin/
In the admin panel you will find an overview of the current queues and its connected consumers and producers when you click on ‘Queues’.
Used Protocol
To communicate with the ActiveMQ adapter in prespective you need to have to apply the following protocol:
Message is not supported, only MapMessage.
The structure for the MapMessage is:
<MAPMESSAGEINSTANCE>.Properties.Set<TYPE>("<TYPE>",<VALUE>);
<MAPMESSAGEINSTANCE>.Properties.Get<TYPE>("<TYPE>");
Each type has a specific Set and Get command. This differs a little bit per language. Please visit the ActiveMQ supported language page to check yours https://activemq.apache.org/cross-language-clients
c#:
_mapMsg.Properties.SetBool("BOOL", true);
_mapMsg.Properties.GetBool(”BOOL”);
Destination = queue as defined in plc address
CorrelationID = same as defined in ActiveMQ adapter settings
Supported Types
BOOL
BYTE
SBYTE
WORD
DWORD
SHORT
USHORT
INT16
UINT16
INT32
UINT32
INT64
UINT64
REAL32
REAL64
BYTEARRAY
STRING
STRUCT
Naming Rules
Setting up the component works as like any other prelogic component. The thing you have to take into account is how the PLC Address Path Format (or implicit naming rule) is configured. The output of this Address is the path to the queue.
ie. Simulator1.DrivenStepper.iPosition
Simulator1 is the instance name of the simulator
DrivenStepper the instance of a motor object
iPosition is the variable name as defined in the signal definition
This structure is based on MQTT and can be adapted to any personal preference, because this adapter implementation uses queues instead of topics.
Prespective Documentation