Overview:

The next few examples use PostGIS and Node.js to deliver notifications to FME Server in real-time using a variety of methods. The method used will depend on the individual business requirements and the volume of data that needs to be processed.

The architecture behind this has a PostGIS database with a trigger and function on a specific table that is being ‘watched’. As a row is created, deleted or modified this calls a function. The function extracts any desired columns in the data and builds a JSON message to send to an open channel. NodeJS is watching the channel and can process it when it arrives.

Credit goes to the following blog articles that have documented this methodology:

In the following exercises, Node.js uses a variety of methods to communicate with FME:

HTTP POST Requests to FME Server: This exercise takes each change to the database table and sends a notification to a Topic in FME Server. If a workspace is subscribed to that topic it will be able to read in the topic message and process the feature.

Streaming features from PostGIS to FME using WebSockets: This exercise shows how Node.js opens a WebSocket channel, using FME Server as the WebSocket Server. The information streamed can be viewed as topic messages if using the WebSocket Publication in FME Server. This exercise uses the WebSocketReceiver transformer in FME Workbench to allow features to be processed as they arrive.

Streaming features from PostGIS to Amazon SQS - Process in FME: This exercise shows how Node.js can send messages to an Amazon SQS (Simple Queuing Service). As a row in the database is changed Node.js will add information about this feature to a queue. FME can be setup to process this information either as the Amazon SQS Publication service, sending features to a topic or by using the SQSReceiver in FME Workbench. The SQSReceiver adds extra flexibility over the Amazon SQS Publication.

Requirements:

For these exercise you will need FME Server, a PostGIS database, PG Admin, an Amazon SQS and an installation of Node.js and various packages.