Introduction
FME Server 2012 can truly "push" a message to any url or email when a workspace is completed using the Notification Service. In the example below we will post some content to a Web Service when a workspace completes. The Web Service we are pushing to is for demonstration purposes only and we can see that our post was successful. But you can use this approach to push a message to any web service when a workspace runs.
We do this by creating a Topic on FME Server which can be notified when a workspace succeeds or fails. Then we create a subscriber to that topic which can "push" a message to a sample url. Finally we trigger the topic by running a workspace.
Steps to Run in Live on FMEServer.com
1. Run the WorkspaceClick the
Run it Live link below and you will open a run form for the workspace
NotifyFMEServer.fmw on FMEServer.com. Notice there is a parameter to either Succeed or
Fail. If you choose
Fail the workspace will fail (using a
Terminator transformer) and a failure message will be sent the Notifcation Service. Choose either
Succeed or
Fail and run the workspace with the Run button.
2. View the Result
Running the NotifyFMEServer.fmw workspace on FME Server notified either the success or failure Topic on FME Server. A Subscriber to this Topic pushed the notifcation message to a demonstration Web Service* using http POST. You can see the content you posted by going to this web page (http://posttestserver.com/data/). Browse into the year, date and time you ran the workspace and you should see a record that FME Server posted (FMEServer.com is running in Pacific time) Here is the record I just created while writing this article:
.
* Thanks to Henry Cipolla for the testing webservice (http://posttestserver.com/)

Steps to use Notification on your own FME Server
Above we ran this live on FMEServer.com but you can set this up on your own FME Server.
1. Create the Topics
We need to create Topics which are the things we will notify when our workspace has run - successfully or not. Start your FME Server Web Admin UI (Start > Programs > FME Server > Web Admin Interface) and login. Go to the Notifications tab and click the Topics tab within it. Create two new Topics: MySuccessTopic and MyFailureTopic.

3. Set-Up the Subscription
The next step is to create a Subscription which is a task that will fire when the topic is notified. In the Web Admin UI - Notifications tab and click on the Subscriptions tab within it. Under Subscriptions click New and choose the type Push.
- Give the subscription a name such as "Push to Web Service".
- In the field for Target Url enter: http://posttestserver.com/post.php*.
- Under content format select JSON .
- Select the Topics MySuccessTopic and MyFailTopic and and assign them.
* Thanks to Henry Cipolla for maintaining the testing webservice (http://posttestserver.com/). When we are done we can go to this site and the see the results of our post.

4. Set-up the Workspace
Download the zip file attached to the article Notify an FME Server Topic on Success or Failure of a Workspace and extract the workspace NotifyFMEServer.fmw
This workspace can contain any workflow you wish - the point of this exercise is push a notification after the workspace completes.
The workspace contains a Shutdown Python Script which notifies FME Server topics based on success and failure. You can examine the script in the Navigation Panel by going to Workspace Parameters > Advanced > Shut Down Python Script. The script can be copied into any other workspace as long as you create and set the published parameters listed below. Rather than using the python script you can use the FMEServerNotifier transformer to Notify a topic although with this method you cannot pass on the success or failure message because the workspace will not have completed.
Below are the parameters required by the script. The parameters are published in the sample workspace but can be converted to private parameters if you prefer. Use File - Prompt and Run to start the workspace and examine the parameters.
- SuccessTopic: MySuccessTopic
- FailTopic: MyFailTopic
- FME Server Host: <url to root of your FME Server Host>
- UserName and Password OR you can use a REST security token*
- Succeed or Fail: Choose success for this example
*Get a REST Security token by opening your FME Server REST User Interface, Start > Programs > FME Server > REST Interface. Here you can log in to create and copy security Token.

Once you have set the parameters to reflect your own FME Server system go ahead and run the workspace in FME Desktop. The log will show whether the workspace successfully notified FME Server of it's success or failure.
Note: If you leave the parameters as they are and run the workspace, it will notify the live server we have running on FMEServer.com and you should still be able to see the results.
4. Viewing the Result
When you ran the workspace above FME Server should have been notified on the success or failure topic. The log file in FME Workbench will tell you if the notification was successful. If the notification was successful and your MySuccessTopic was notified then any subscriber to that topic executed. In this case we pushed a message to the test web server and we can view the results here: http://posttestserver.com/data/
Browse into the year, date and time you ran the workspace and you should see a record that FME Server posted. Here is the record I just created while writing this article:
