Setting Up Messaging Overview
  • 21 Apr 2022
  • 3 Minutes to read
  • Dark

Setting Up Messaging Overview

  • Dark


Messaging Handlers and Queues are pluggable systems that can be extended via the SDK to support built-in messaging systems are RabbitMQ, Azure Services, Apache Kafka, database queue, file system queue, and in-memory queue. 

The Message Queue Handler Flows handles messages as they are received within an assigned message system queue.

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. 

Message Handler Configuration

Configuration OptionsFunction 
Handler NameThis is the name that will appear for this handler in the Decisions environment.
Message HandlingThis shows a dropdown list of options to choose from regarding how to handle the messages that are received.
Lease: Locks the message in the queue
Lease w/ Expire: Locks the message in the queue with an auto-timeout.
Get: Receives the message and leaves it in the queue after it has been processed.
Get and Remove: Receives the message and removes the message after it has been processed.
Active Flow CountThe maximum number of simultaneous messages that Decisions will process.
Handler FlowThe Flow is used to process messages that appear in the queue.
Message QueueThe queue for the handler to listen on.

The Get function reads messages from the message server and communicates to the server that the messages are processed and then are typically removed from the queue. This mode instructs the message server or third-party client to pull messages off the message server as fast as possible while keeping them on an in-memory list for later reference.

The Lease function reads messages from the message server and communicates to the server that the messages are processed. The message server then keeps the messages in the queue and marks them as "leased" by a client i.e. Decisions to prevent delivery to other requesting clients. 

When the client finishes handling the message by running the Handler Flow, it tells the message server that the message has been handled and then marks it for deletion. 

If the client is unable to complete this due to for example an error, then the lease eventually times out thus marking it as deliverable to other clients again.

Setting up a Listener/Message Handler

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

  1. Create a new Flow.
  2. Navigate to the Properties > SETTINGS. Expand the Behavior Type dropdown menu and select Message Queue Handler Flow.

    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. From Toolbox, navigate to DATA > TEXT and attach a Get String From UTF 8 Bytes step to the Start step. 
  4. Navigate to Properties > INPUTS and change the Bytes mapping type to Select From Flow. Select Message.Payload. Click DONE. 
    RabbitMQ Messages are typically encoded in UTF8. Other messengers may use Base 64, Ascii, or a different UTF decoding step to help decode the Payload.

  5. Attach a Show Popup step from Toolbox > FAVORITE STEPS, to the Get String From UTF 8 step and connect it to the End step. 
  6. Map GetStringFromUTF8Bytes1_Output to Message, and Constant map the desired Subject

  7. Click Save to save the Flow.

Subscribing to a Queue

  1. If a Queue has not been added, navigate to System > Jobs & Events > Message Queues. Click ADD RABBIT QUEUE from the Global Action Bar
  2. From the Add Rabbit Queue window, define the Message Queue parameters and click SAVE. 

Connect Processing Flow to Queue

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. Click ADD MESSAGE HANDLER.

  2. From the Add Message Handler window, define the desired Handler Name, select the desired Message Handling behavior, define the Active Flow Count, create or pick the Message Handler Flow, then select the Message Queue. Click SAVE. 

    For further information on Modules, visit the Decisions Forum.

Was this article helpful?

What's Next