Skip to main content
InterSystems Supply Chain Orchestrator 2024.1
AskMe (beta)
Loading icon

Sending Messages to Amazon SQS from a Production

An InterSystems IRIS interoperability production can be an Amazon SQS producer. You have two options: use a built-in business operation or build your own business operation that uses the SQS outbound adapter. There is also an API for use outside of a production.

Using the Business Operation

InterSystems provides a built-in business operation that can be used to publish messages to an Amazon SQS message queue without needing to write custom code. To use this business operation:

  1. Add EnsLib.AmazonSQS.BusinessOperation to your production. See Adding Business Hosts.

  2. Configure settings of this business host as described in Amazon SQS Settings.

  3. Configure other business hosts to send EnsLib.AmazonSQS.MessageOpens in a new tab requests to this business operation. See Amazon SQS Message Class for details.

When this business operation receives a message of type EnsLib.AmazonSQS.MessageOpens in a new tab, it publishes that message to SQS.

Amazon SQS Message Class

The EnsLib.AmazonSQS.MessageOpens in a new tab class has properties for defining the message, including the following:

  • queue defines the Amazon SQS queue where the producer is sending messages.

  • body defines the content of the message

For full descriptions of the message identifiers this class makes available through message object properties, refer to the Amazon SQS documentationOpens in a new tab.

You can also use the messageAttributes property to specify custom metadata for your message. The messageAttributes property accepts a %ListOfObjects collection of %External.Messaging.SQSMessageAttribute objects. See the documentation for the Amazon SQS API for further guidance on creating SQS message attribute objects. For general information about the use of message attributes to attach custom metadata, refer to the Amazon SQS documentationOpens in a new tab.

Using the Adapter

If the SQS business operation does not meet your needs, you can directly use the SQS outbound adapter as follows:

  1. Create a custom business operation class:

    • The class should extend Ens.BusinessOperationOpens in a new tab.

    • The ADAPTER parameter should equal EnsLib.AmazonSQS.OutboundAdapterOpens in a new tab.

    • The class should define a message map:

      XData MessageMap
      {
      <MapItems>
        <MapItem MessageType="messageclass">
          <Method>methodname</Method>
        </MapItem>
        ...
      </MapItems>
      }
      
    • The class should define all the methods in the message map. These methods are known as message handlers. Each message handler should have the following signature:

      Method Sample(pReq As RequestClass, Output pResp As ResponseClass) As %Status {
      }

      The message handlers can call the instance methods of the adapter, which is accessible as the Adapter property of the business operation. The general syntax for calling these methods is as follows:

       do ..Adapter.MethodName(arguments)

      The SQS outbound adapter has one instance method, named SendMessage(), with the following signature:

      Method SendMessage(msg As EnsLib.AmazonSQS.Message) As %Status{
      }

See Also

FeedbackOpens in a new tab