Outgoing Message Content
When a workspace triggers a topic it can include (like other publications) a message.
The ability to construct message content from a variety of sources – including spatial – is a key reason for using FME workspaces as a publisher. Workspaces can transform data in multiple ways, use it to construct a message, and then dispatch that message to users as a notification.
When a topic is triggered by the FMEServerNotifier transformer, the message can be defined by an attribute, constructed in a text editor, obtained from a user parameter, or even set up as a conditional value:
When a topic is triggered by registering the workspace with a service topic, the message is sent via a Writer:
Here the message is being passed through a text file Writer.
Content Format
For the purposes of FME notifications, the content of a workspace publication can be in any format, maybe just a plain text message. However, for the benefit of a web-based subscriber the outgoing message is often in a JSON or XML format.
For example, here a workspace constructs a plain-text weather (lightning) alert using an AttributeCreator. The message attribute is connected to a Text File Writer in order to provide a means for publishing the outgoing message:
Importantly, the text file Writer has a MIME type setting that can be applied:
So even if the message were JSON or XML, standard practice is to use a text writer.
Ms Analyst says... |
A Text File Writer is the usual method of supplying messages, regardless of format. i.e. even if the message is constructed as a snippet of JSON or XML, it would still be passed through the Text File Writer. |
Email Content in a Workspace
The message being passed out of a workspace may need to be in the form of an email. This, like any other message, can be constructed as an attribute with transformers.
For example, for a JSON-formatted email you could construct an attribute like this:
{ "email_to" : "[email protected]", "email_cc" : "", "email_from" : "[email protected]", "email_replyto" : "", "email_subject" : "Notification Subject", "subscriber_content" : "Notification Content" }
This could be created using an AttributeCreator transformer, where the email addresses and content can be substituted with attribute or parameter values as required.
The actual email content could be plain text or, if the Email format is set to HTML in the Notification GUI, then it could be constructed as HTML instead.
Ms Analyst says... |
The FMEServerEmailGenerator is a custom transformer available in Workbench for generating email content in the correct format and structure |