1. Home
  2. Workflow & Automation
  3. Windows Services
  4. Processing trellispark Messages Using a Windows Service

Processing trellispark Messages Using a Windows Service

This article will describe how the trellispark generic windows service processes queued messages. There is a code overview followed by how to configure a message queue for the service. Everything in this article depends on a service using the trellispark generic windows service template. To learn how to create your own generic service, please refer to this article.

This process is dependent on the trellispark messaging base class. First the service reads it’s configuration to get the list of message queues it needs to process. Then for each queue, it runs the MessageServices method ProcessMessages to process all messages in the message queue.

XElement result = await ExecuteTSQL(userData, ServiceGUID, "Get_ZSO_MessageQueue", myDB);
foreach (XElement queue in result.Elements("Table"))
{
    string queueName = queue.GetElement("MessageQueueName");
    try
    {
         MessageInformation message = new()
         {
              SessionGUID = userData.SessionGUID,
              UserGUID = userData.UserGUID,
              MessageQueueName = queueName
         };
         MessageServices messageServices = new(myDB);
         await messageServices.ProcessMessages(message, XElement.Parse(queue.GetElement("InstanceData")));
     }
     catch (Exception ex)
     {
         await myDB.LogEvent(1, "ProcessMessageQueues ServiceGUID: " + ServiceGUID.ToString() +" Queue: " + queueName + " Unknown error: ", ex.ToString());
     }
}

Configuration

To configure a trellispark message queue for processing, first open the Workspace application in the workspace and navigate to the Service tab. Then open the service to configure.

Service Definition

When you are looking at the page above, click the “Add new item” button in the Message Queues childlist. You will be presented with the following page.

Message Queue Overview

Provide a human readable name in the Message Queue Name textbox, then select the Message Queue direction. Inbound will process messages being sent from external services to a local mailbox. Outbound will send messages to external mailboxes. Next, you will need to configure the Message Queue Type.

There are several types of message queue available to trellispark. Once documentation for these message queue types are available, links to those documents will be below.

Updated on November 24, 2022

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment