FME Workspace Subscriber
The FME workspace subscriber subscribes an FME Desktop workspace to a Notification Service topic. The specified workspace runs each time it receives a notification from the specified topic. The workspace must be already uploaded to FME Server. To use the contents of the notification in the workspace, specify a workspace published parameter to obtain its data from the notification. Alternatively, use readers, writers, or transformers that are equipped to receive JSON-formatted notifications.
Note: Support for the FME workspace subscriber in the FME Server REST API begins in version 3 (REST v3), available with the FME Server 2016 release. The workspace subscriber is not supported in earlier versions of the FME Server REST API.
Configuring the Subscriber
- In the FME Server Web User Interface, select Notifications > Subscriptions, and click New.
- Provide a Name for the Subscription
- In the Protocol drop down menu, select FME Workspace.
-
Specify the Topics you want to subscribe to using the drop-down selector. To create a topic and use it right away, click +.
- Repository: Specify the repository in which the workspace resides.
- Workspace: Specify the workspace you want to subscribe.
- If the specified workspace has any published parameters, configure the settings you desire when the workspace runs.
- Get Value from Topic Message: This setting applies to any published parameters that represent a source file. When checked, the notification contents are written to a file, and the published parameter obtains its data from the file.
- Send Result Data in Success Topic Message: This setting applies to any published parameters that represent a destination file. When checked, the published parameter's results are written to an output file, which can be parsed as XML, JSON, or text. The contents of the file are included in the notification that is sent to the topic specified by Post to Topic on Success (below).
If the notification contains a subscriber_content keyword, the value is written to the file without any parsing. This approach is a good way to send any arbitrary notification content to a workspace. Otherwise, the full notification is parsed and written to the file in JSON format.
A common practice is to expose a Text File or JSON reader's source dataset as a published parameter. When checked, the feature(s) produced by the reader are available through the notification contents, or they can be read in a transformer such as the AttributeFileReader.
Note: Notifications are written to the System > temp > subscriptions folder in Resources. In the workspace, the notification can also be accessed through the FME_TOPIC_MESSAGE workspace parameter.
Note: The output file is written to the System > temp > subscriptions folder in Resources.
- Configure topics for Success/Failure notifications, as desired. For more information, see Monitoring FME Workspace Subscribers below.
- Configure the Advanced Settings, as desired. These settings affect all jobs that are run by this workspace, when triggered by the subscriber:
- Click OK.
Job Priority (optional): The priority of the job that is run by the workspace.
Job Routing Tag (optional): To associate the job with a specific FME Engine, specify the name of the job routing tag associated with that engine. For example, if Engine 1 is configured with the "utility" tag in the FME Server configuration file, as TM_ENGINE_1=engine1:utility
, specify utility
. For more information about job routing, see Configuring Job Routing.
Queued Job Expiry Time (optional): The length of time, in seconds, after which a job that is waiting in queue does not execute. If the job does not execute before this time is reached, it remains in the queue until it is ready to execute, but execution is not attempted. This directive is useful for time-sensitive jobs that you do not want to run after the specified time is exceeded.
Running Job Expiry Time (optional): The time, in seconds, a job will remain in the running state. This directive is used to ensure that a job does not hang and block an FME Engine indefinitely. The minimum allowable value is 1.
Run Until Cancelled (optional): If checked, the job runs continuously, even after a server shutdown or crash, until it is explicitly canceled.
Monitoring FME Workspace Subscribers
You can monitor the success or failure of workspace subscribers by publishing notifications to topics when any of the following occurs:
- A workspace subscriber successfully receives a notification from a topic.
- A workspace subscriber fails to receive a notification from a topic.
After specifying topics, you must configure a subscription to receive the notification. To process the notification in the message body of the subscription, use the keywords in the JSON template that is generated for each type of notification, as follows:
Subscriber Failure Notification Template
{
"subscription" : <subscriptionName>,
"status" : "failure",
"msg" : <failureMsg>
}
Subscriber Success Notification Template:
{
"subscription" : <subscriptionName>,
"status" : "success",
"msg" : <successMsg>
}
For an example of how to configure an SMTP Email Subscriber using notification template keywords in the email message body, see Email Template Language.
For more information, see Monitoring FME Server Activity with Notifications.