Routing complete incoming messages

A JsonMessageRouter component directs a whole incoming message (payload) to a new slot so that incoming messages may redirect the JSON to be handled by another component, such as a “handler” component type.
  1. Open the jsonToolkit palette, expand Inbound > Routers and drag a JsonMessageRouter component to a working folder in the station.
  2. Open the router Property Sheet by double-clicking the JsonMessageRouter component.
  3. Type a value in the Key property to identify the type of message (for example: messageType) and click Save.
    Enabling Learn Mode adds a dynamic slot on input. This procedure documents how to add the slot manually.
  4. Manually add a dynamic string slot to the router component by opening the AX Slot Sheet view, or by simply right-clicking the sheet and clicking Add Slot.
    An Add Slot window opens for either method, as shown below.
    Adding a slot from the Slot Sheet View Adding a slot using the Action menu
    Image Image
  5. Give the slot a name, use the transient and read-only flags to avoid onward handlers running again at station start and click OK.
    The new slot is added.
    Image
  6. On the Wire Sheet, connect the router.
    The following Wire Sheet routes the entire incoming message to the dynamic slot for onward processing:
    Image

    For example, if Key = messageType, the JSON routes this message to a string slot with a name “alarmAck” and then on to connected handlers, as shown above.

    {
      "messageType": "alarmAck",
      "user": "AJones",
      "alarmId": [ "5cf9c8b2-1542-42ba-a1fd-5f753c777bc0" ]
    }