Send Messages to Amazon SNS from a Production
Amazon SNSOpens in a new tab is a cloud service that delivers messages from a publisher to a subscriber. You can configure your InterSystems product to be an SNS publisher by creating an interoperability production that includes a business operation that uses the SNS outbound adapter. If you are new to business operations and adapters, see Introduction to Interoperability Productions.
There are three components to a message sent to SNS: a topic, a subject, and the content of the message. Each message sent by a publisher to SNS must be associated with a specific topic. SNS pushes messages to subscribers who have subscribed to a particular topic. A message sent to SNS can also include a subject, which SNS uses as the Subject line when the message is distributed to subscribers as an email.
The ObjectScript class of the SNS outbound adapter is EnsLib.AmazonSNS.OutboundAdapterOpens in a new tab. If you are using the built-in business operation, you do not need to know about the details of this outbound adapter — the business operation takes care of it. But if you are writing a custom business operation, it calls the adapter’s Publish() method to send messages to SNS. To call this method from a custom business operation, you could add the following:
Set tSC = ..Adapter.Publish(..ARNTopic, request.Message, ..Subject)
ARNTopic is a property of the business operation that defines the SNS topic. Required.
request.Message is the property of a production request object that contains the message sent to SNS. Required.
Subject is a property of the business operation that defines the SNS subject. Optional.
You can look at the source code of EnsLib.AmazonSNS.BusinessOperation for an example of how this works. For details about creating a custom business operation, see Defining Business Operations.
The SNS outbound adapter was developed using the InterSystems PEX framework, so the ObjectScript source code for the adapter looks different than other adapters. For example, the adapter methods are actually wrappers for methods written in a Java PEX component.
Built-in Business Operation
InterSystems provides a built-in business operation that can be used to publish messages to SNS without needing to write custom code. Since it uses the SNS outbound adapter, this built-in business operation is all you need to turn your production into an SNS publisher. Simply add EnsLib.AmazonSNS.BusinessOperationOpens in a new tab to your production and configure your other business hosts to send EnsLib.AmazonSNS.PublishRequestOpens in a new tab requests to this business operation. For information about adding a business operation to a production, see Adding Business Hosts.
The EnsLib.AmazonSNS.BusinessOperationOpens in a new tab business operation includes a property ARNTopic that is used to associate messages with an SNS topic. You can use the SNS > ARNTopic setting in the Management Portal to specify the topic.
You can use the SNS > Subject setting to give messages sent by the business operation a subject. Defining a subject is optional.
While the topic and subject of a message are defined in the business operation, the actual content of a message is sent to the business operation in a EnsLib.AmazonSNS.PublishRequestOpens in a new tab request, so configure your production to send this request object from another business host.
General AWS Settings
The SNS outbound adapter extends a common adapter class that includes general AWS properties. When you add a business operation that uses the outbound adapter to a production, these AWS properties can be set using the AWS settings for the business operation in the Management Portal.