Workspace Notifications, Part 1: From within the workspace

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2016.x

Introduction

The recommended method for sending a notification while a workspace is running is the FMEServerNotifier. This transformer allows you to select a topic, and specify a message. The message can be generated on the fly from feature attributes, workspace parameters, or system parameters. This method works in FME Desktop and on FME Server.

 

In this example, we will be generating notification content dynamically, formatting it for use by the email subscriber, and notifying FME Server from within a workspace. The actual work done is a simple conversion from MapInfo TAB to File Geodatabase.


Step-by-step Instructions

1) Use an existing workspace, or use the sample provided (demoNotify-Begin.fmwt). A completed workspace has also been provided in the zip file (demoNotify-Complete.fmwt).

2) Branch off from the main workflow at the point where you’d like to send a notification. Add an Aggregator transformer and connect it to the second stream of data coming from the bikeways feature class. Configure it as follows:

aggregator.png

3) Add a TimeStamper.

4) Add an AttributeCreator. Create the following attributes, with the values specified. For the full list of keywords, see the email subscriber documentation.

email_subject: FME Notification: $(FME_MF_DIR)
email_to: user@example.com
email_from: fme@example.com
subscriber_content: Notification generated at @Value(_timestamp). @Value(_count) features were read.

5) Use a JSONTemplater to build up the notification. The JSONTemplater uses XQuery to format the template, and the syntax is attached below:

{
    "email_from" : fme:get-attribute("email_from"),
    "email_to" : fme:get-attribute("email_to"),
    "email_subject" : fme:get-attribute("email_subject"),
    "subscriber_content" : fme:get-attribute("subscriber_content")
}

6) Add an FMEServerNotifier, and configure as follows:

notifier.png

Here is the completed workspace:

workspace.png



7) Run the workspace. When it is run, it will publish to SAMPLE_TOPIC. You can see the result using Topic Monitoring on the Notification page in the FME Server Web Interface.

notifications.png

 

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.