Documentation for Axxon PSIM 1.0.0-1.0.1.

Previous page HTTP-Server requests  APPENDIX 2. NissObjectDLLExt and CoreInterface class declarations Next page


Axxon PSIM can act as receiver and transmitter of RabbitMQ events. Download and install the following components from the https://www.rabbitmq.com/install-windows.html website before using this functionality:

  1. Rabbit service.
  2. Erlang.

By default, RabbitMQ has a built-in guest/guest account that only works with localhost. Create a new account to use RabbitMQ remotely.

The examples below mention the amqp_sendstring.exe and amqp_listen.exe utilities. These utilities for processing and sending messages from the Axxon PSIM are to be implemented by programmer.

The connection to RabbitMQ is configured as follows:

  1. Go to the RabbitMQ tab on the Security zone object settings panel on the Programming tab of the System settings dialog box (1).
  2. In the Host field, enter the name or address of the RabbitMQ host (2).
  3. In the Port field, enter the port to connect with the RabbitMQ host (3). If the port is 0 or not set (by default), the RabbitMQ client does not run.
  4. In the User field, enter the RabbitMQ user name (4).
  5. In the Password field, enter the RabbitMQ user password (5).
  6. From the Content-type drop-down list, select the data type to be sent and received by Axxon PSIM (6):
    1. application/jsona message is sent and received in JSON format. If Axxon PSIM cannot parse the message in JSON format, an attempt is made to recognize the message in plain/text format.

    2. plain/textthe Axxon PSIM event is sent and received in the format "TYPE|ID|EVENT".

  7. Click Apply (7).

Axxon PSIM provider and third party receiver

Axxon PSIM provider operates in amq.topic mode, and the receiver operates in amq.direct mode.

amq.topic allows for subscriptions ranging. Each event sent from Axxon PSIM is signed with a special header, which is built according to the following scheme:

routingkey = "psim.event." + msg.GetSourceType() +"." + msg.GetSourceId() + "." + msg.GetAction();

So the receiver can subscribe to any event(s).

Example.

Subscription to all events:

amqp_listen.exe localhost 5672 amq.topic psim.event.# 

Subscription to Action==”RUN” events

amqp_listen.exe localhost 5672 amq.topic psim.event.*.*.RUN

Important!

Events enter the RabbitMQ queue from each Axxon PSIM core individually. For example, if there are two cores in the system, and the event occurred on a core that has incorrect settings or does not have a connection to RabbitMQ, the event will not get into the queue, despite the fact that the second core will receive it. Each core sends only its own messages.

Axxon PSIM core receiver

The receiver is implemented according to the amq.direct scheme. It is subscribed to all events with the "bindingkey" key. bindingkey should have the following format: "psim." + ComputerName (case sensitive).

When sending, the bindingkey must be specified exactly as it is registered at the receiver, otherwise the message will not be delivered.

Example events that will be receiver by Axxon PSIM core:

text:

amqp_sendstring.exe localhost 5672 amq.direct psim.ASUS "CAM|1|HELLO"

or JSON

amqp_sendstring.exe localhost 5672 amq.direct psim.ASUS {\"Type\":\"MACRO\",\"Id\":\"1\",\"Action\":\"RUN\",\"Params\":{\"test1\":\"+++\",\"test2\":\"000\"}}
  • No labels