How To Publish Messages To Amazon SNS Using JSCAPE MFT Server

This tutorial demonstrates how to configure JSCAPE MFT Server to publish messages to Amazon SNS when certain events occur.

  1. Blog

In this post, you'll learn how to publish messages to an Amazon SNS (Simple Notification Service) topic using JSCAPE MFT Server. There could be a couple of reasons why you would want this capability, but one big reason is so that you can get notifications when certain events occur on your server. This will keep you on top of things and enable you to act on them before they turn into issues.

What we want to do

Here's an illustration of what we want to do. We're going to set up a trigger that will be listening to a particular event. Once that event occurs, the trigger will then respond by publishing a message to an Amazon SNS topic. Amazon SNS will then take charge of pushing that message to that topic's subscribers. These subscribers can be web servers, email addresses, phone numbers, Amazon SNS queues, and so on.

For this particular example, we're going to create a trigger that will respond whenever our JSCAPE MFT Server instance receives a request from a client that's attempting to download a particular file. The response will then be a message containing pertinent information regarding the request, like client IP, client port, username, and so on.mft_server_publish_message_to_amazon_sns

Watch the video

Would you prefer to watch a video version of this tutorial instead? You can play the video below. Otherwise, just skip it if you wish to continue reading.

Prerequisites from AWS

Before you start setting anything up on JSCAPE MFT Server, there are a few things you'll need from the Amazon AWS side. This would include the following:

  • Security credentials like your Access Key ID (we call this Username / Access Key on MFT Server) and its corresponding secret key (a.k.a. password)
  • The AWS region at which the SNS topic is associated with
  • The topic's ARN (Amazon Resource Name)

Creating an SNS topic - a brief example

If you've never tried creating an SNS topic yet, here's an overview of what you need to do. I'm going to assume you already have an AWS account though and that you already have your security credentials on hand.

So, first, fire up your web browser, sign in to the AWS Console and go to Services. After that, type in and select SNS from the search box.

001 - sns in aws console search box

Next, go to Topics and then click Create topic.

002 - create amazon sns topic

Take note of the region in the upper-right corner of the screen (Ohio, in this case). You'll need that later when you create an AWS trading partner on JSCAPE MFT Server.

Give the topic a name (e.g. mftservermonitoring) and click the Create topic button.

003 - amazon sns topic name

Once the topic has been created, take note of its ARN. You'll need that later as well when you create a trigger on JSCAPE MFT Server.

004 - amazon sns arn

Now that you have your SNS topic ready, the last thing you need to do is add subscriptions to this topic. For now, let's just add an email address. Once JSCAPE MFT Server publishes a message on this topic, SNS will forward that message to that email account. If there are multiple subscriptions, then the message will be pushed out to all those subscriptions.

So, to create a subscription, just click the Create subscription button.

005 - create a sns topic subscription

Select the protocol for the endpoint you wish to subscribe. So, for example, since our endpoint is going to be an email address, then we just select Email from the list of protocols. Other supported protocols include HTTP, HTTPS, Email-JSON, Amazon SQS, and Amazon Lambda.

After that, enter the email address of the intended recipient and then click the Create subscription button.

006 - create a sns topic subscription

You should then see your subscription in the list of subscriptions under the SNS topic you created. You can add more subscriptions if you want.

007 - sns subscriptions

The subscription will remain pending until the owner of the endpoint will confirm the subscription. So, in the case of email endpoints, the owner of the email account will receive a subscription confirmation email where he/she has to click a link to confirm the subscription. Only after the subscription is confirmed will that endpoint be able to receive SNS messages.

So, now that you're done setting things up on the AWS side, it's time to configure your JSCAPE MFT Server instance to send out those messages.

The first thing you need to do is create an AWS trading partner. This trading partner will contain all the necessary details for connecting to AWS, which you can then reuse when you create various triggers that send out messages to your topics on Amazon SNS.

Creating an Amazon AWS trading partner

To create an Amazon AWS trading partner, login to your MFT Server manager, Navigate to a domain, go to the Trading Partners module, and then click the Add button.

008 - add amazon aws trading partner

Select Amazon AWS from the drop down list and then click the OK button. Notice that there are several other trading partner protocols in there, like: Amazon S3, Box, DropBox, Google Cloud, IBM Cloud, Azure, and many others that you can integrate MFT Server with.

009 - add amazon aws trading partner

Once your'e inside the Amazon AWS trading partner dialog, you can then specify this trading partner's parameters. Start by giving this trading partner a name. I'm calling mine TP-SNS-1. After that, enter your AWS Access Key and its corresponding Secret Key. You should also select the appropriate Region. You can then test this connection by clicking the Test Server button. If everything's good, you should see a message box that says the test passed. Click OK to proceed.

010 - add amazon aws trading partner parameters

Now that you have your AWS trading partner ready, the next step is to create a trigger that would listen for a certain event and then publish a message to an Amazon SNS topic when that particular event occurs. Let's do that now.

Creating a trigger for posting a message on Amazon SNS

Go to the Triggers module and click the Add button.

011 - add trigger for publishing amazon sns message

Give the trigger a name and select the event type you wish this trigger to listen for. In our case, we've selected the File Download Started event type. Click Next to proceed.

012 - trigger event file download

The next step is to specify certain conditions that would limit the response of this trigger to specific events. So, for example, this particular trigger will only respond to a File Download Started event that involves the txt file shown below. Click Next to proceed.

013 - trigger conditions box

Click the Add button to add the trigger action that will be responsible for publishing a message to a specified SNS topic.

014 - add trigger action

Select Amazon SNS Publish Message from the drop-down list and click OK.

015 - amazon sns publish message trigger action

In the trigger action parameters dialog, specify the following

  1. The trading partner you created earlier;
  2. The ARN of the Amazon SNS topic to which the message should be published. Note that you don't need to memorize this. MFT Server will populate this list box with all the topics available in your SNS;
  3. The message itself. Note that you can use variables to include properties pertinent to the trigger event. So, for example, for this particular event, we could include the Client IP, the Client Port, the Username of the account that downloaded the file, and the local server path of the downloaded file itself.

Click OK to proceed.

015 - amazon sns publish message parameters

If all goes well, you should then see the newly added trigger in your list of triggers.

016 - amazon sns publish message

That's it. Now you know how to configure JSCAPE MFT Server to automatically publish a message on Amazon SNS when a particular event occurs.

Try this out

Would you like to try this out yourself? Download the FREE, fully-functional Starter Edition of JSCAPE MFT Server now.

Download JSCAPE MFT Server Trial