Setting Up Messaging Overview
  • 04 Jan 2022
  • 3 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Setting Up Messaging Overview

  • Dark
    Light

Article summary

Overview

Decisions Messaging is a pluggable system that can be extended via the SDK to support built-in messaging systems are RabbitMQ, Azure Service Bus, Apache Kafka, Database Queue, File System Queue, and In-memory queue. 

In addition to the message system, a Message Queue Handler needs to be configured to process the messages. The Message Queue Handler is a Flow that can be subscribed to a message system queue to handle each message from the queue as the queue receives a message. 

Building a Message Handler Flow requires different steps depending on the contents of the message that is being formatted. Each format has its own steps that extract the contents of the Message. After choosing the correct step for the Message, users can build the Flow to react to the content format.

Prerequisite Features

Any Messaging System module must be installed onto a Decisions instance to follow alongside this article's instructions. The following pre-built Messaging System modules are available:

If using In-Memory, a File System, or a database, then these modules are not necessary. 

Setting up a Listener/Message Handler

To subscribe to messages in a queue, set up the Flow that is going to handle messages.

  1. In a Designer Project, click CREATE FLOW, select Flow, and click CREATE. Name the Flow and click CREATE.
  2. On the Properties panel under Settings, select Message Handler Flow from the dropdown list under Behavior Type. Choosing this Flow behavior provides three additional Flow Inputs: Message, Handler Id, and Headers. The Message Input contains the Payload (Byte[]), Id (String) and MessageDateTime (DateTime) Inputs.
  3. Click on the Done path of the Start step. Navigate to All Steps [Catalog] > Data > Text. Select Get String from UTF 8 Bytes and click ADD.
    If the expected message is text, use a Base 64, Ascii, or UTF decoding step depending on the type of messaging system that is receiving messages. For RabbitMQ, the messages will typically be UTF 8. 

  4. On the Properties panel, select Unknown under the Inputs category and select Select From Flow. Click on Message, select From Payload, and click DONE.
  5. Click the Done path. Select the Show Popup step and click ADD.
  6. Input in a Constant value for the Subject. Click Unknown next to the Message field and select Select From Flow. Select Get String From UTF 8 Bytes_ Output and click DONE.
  7. Connect the Done path to the End step. Click Save to save changes to the Flow.



Subscribing to a Queue

The messaging system Queue will need to be configured in order for Decisions to subscribe to it.


  1. If a queue has not been added, navigate to System > Jobs and Events > Message Queues. Click ADD RABBIT QUEUE.
  2. On the Add Rabbit Queue window, define the Message Queue parameters and click OK.


Connect Processing Flow to Queue

The following demonstrates a Message Queue Handler. The setting options can be overridden to specify different servers or queues by navigating to System > Jobs and Events > Message Queues, creating a message queue and selecting the Override Server Info option.

  1. Navigate to System > Jobs and Events > Message Queue Handlers and click ADD MESSAGE HANDLER.
  2. On the Add Message Handler window, define the required parameter options. When complete, click OK. 
    Configuration OptionsDescription
    Handler NameName to display in Decisions
    Message HandlingSets the Message Handling mode to lease the message (lock), lease the message temporarily (lock with auto timeout), remove it after processing (pop), or use it but leave it on the Queue (peek)

    LeaseReads Messages from the Message Server and tells the Message Server that they are being processed, this is used when every Message must be handled. The Message Server keeps them in the Queue, marking them as "leased" by a client (that is, Decisions), and does not deliver them to any other client that requests Messages from the Queue. When Decisions finishes handling the Message by running the Handler Flow, it tells the Message Server that the Message has been handled and the Message Server marks it for deletion. If Decisions doesn't do this (for example, if the Handler Flow encountered an error), then the lease on that Message will eventually timeout and the Message Server will mark it as deliverable to another client. Lease mode is slightly slower than Get mode but doesn't have the problem where Messages can be lost in memory prior to being processed if the Decisions server shuts down or gets rebooted.

    Lease w/ Expire

    GetReads Messages from the Message Server and tells the Message Server that they have been handled. The Message Server removes them from its Message Queue. This mode instructs the relevant Message Server or third party client to pull Messages off of the Message Server as fast as possible and keep them in an in-memory list for Decisions to pull from

    Get and Remove
    Active Flow CountMaximum number of simultaneous Messages that Decisions will process
    Handler FlowThe Flow used to process Messages that appear in the Queue
    Message QueueThe Queue for the Handler to listen on, that was configured in System Settings




Was this article helpful?

What's Next