FME Version
Files
-
- 400 KB
- Download
As of FME Server 2019+, this functionality can be completed using FME Server Automations. For more information, please see Tutorial: Getting Started with Automations. Note that this tutorial series will no longer be updated, if you encounter an error, please contact Safe Support.
Requirements
FME Desktop 2017
FME Server 2017
Completed Subscribe, Report and Notify: 0. Basics of Notifications
PostgreSQL with PostGIS extension installed with a database named gisdb
Configure/Setup

Database with Subscriptions
Create a database that connects topic names with email addresses, which we call a subscription.
1) Open the 1_create_subscription_database.fmw workspace.
2) Modify the PostgreSQL writer’s connection parameters to match your PostgreSQL database.
Note: the PostgreSQL host and port should be accessible from the machine you create workspaces on and the machine that has FME Server installed on it.
3) Open all three AttributeCreator transformers and change the email addresses to your own email address. For testing purposes, use the +keyword notations to make the email addresses look unique in your email client (eg: fmeserver+transit@gmail.com).
4) Run the workspace to create a table called subscription_database.
At this point you can manually edit the database if you wish to add or edit the subscribers.
Filtering and Notifications
Here we configure a workspace and publish it to FME Server. The workspace will be called when a message is sent to the topic.
1) Open the 1_process_messages.fmw workspace.
2) Open the Joiner transformer and modify the PostgreSQL reader’s connection parameters to match your PostgreSQL database.
3) Note the FMEServerEmailGenerator transformer, which will create the specific JSON required by the Email subscription.
4) Publish the workspace to FME Server:
- Create a repository called notification_tutorial.
- On the Register Services page, check on the Notification Service and click the Edit button.
- Click the ellipsis (...) for the Subscribe to Topics parameter and select concert_communications, nature_news, and transit_tips.
- Click OK .
- If we take a look at the settings we can see that:
- The workspace will be subscribed to three topics: concert_communications, nature_news, and transit_tips.
- The incoming notification message will be read in by the Text File reader.
- The workspace will publish a message to a topic when it completes successfully: email_out.
- The feature written to the Text File writer will be sent to the email_out topic.
-
- Click OK.
- Click Publish.
5) Open the FME Server Web User Interface and create an Email subscription that is subscribed to the email_out topic. Go to Notifications > Subscriptions and click New.
6) Set the New Subscription parameters as follows:
- Name: Email Out Subscribe Tutorial
- Protocol: Email
- Topics Subscribed To: email_out
7) Set the Protocol Settings parameters as relevant to your email client. For more information on these parameters, check out the Email Subscriber documentation.
Now you have a configuration that will:
- Receive messages from the concert_communications, nature_news, and transit_tips topics.
- Check the database to see which email addresses are subscribed to the topic the message came from.
- Send an email notification to the subscribed email addresses.
Report a Message
Now we will send a test event to the topics.
1) Open the FME Server REST API from the FME Server Web User Interface by clicking: Developers> REST API > API> notifications: Notifications Manager > POST /notifications/topics/<topic>/message
2) For the body parameter enter:
{
“subject”: “important message, stop everything and read”,
“message”: “There was a sighting of a rare <b>warbleddash lizard</b> in South America!!!”
}
3) For the topic parameter enter: nature_news.
4) Click the Try it out! button.
5) You will be prompted to login. Login with your FME Server username and password. Click Lookup Existing Token. Click Close. Click Try it out! again.
6) You should receive an email to the address you specified for the nature_news topic back when you created the database. If you didn’t receive an email: try using Topic Monitoring on the Notifications > Topics page of the Web User Interface to monitor the four topics and also double check subscription settings.
7) Try sending another message to the transit_tips topic:
{
“subject”: “this just in…”
“message”: “Use transit to make my commute easier <i>:-)</i>”
}
Now you have created a simple system for managing subscriptions to topics using a database!
Comments
0 comments
Please sign in to leave a comment.