Files
-
- 200 KB
- Download
Introduction
The recommended method for sending a notification while a workspace is running is the FMEFlowNotifier. 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 Form and on FME Flow.
In this example, we will dynamically generate notification content, format it for the email subscriber, and notify FME Flow 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 is also included 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:
3) Add a DateTimeStamper.
4) Add an AttributeCreator. Create the following attributes with the specified values. For the full list of keywords, see the email subscriber documentation.
-
email_from:
fme@example.com -
email_to:
user@example.com - email_subject: FME Notification: $(FME_MF_DIR)
- 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 FMEFlowNotifier, and configure as follows:
Here is the completed workspace:
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 Flow Web Interface.