Skip to main content

Hello everyone! I'm a novice in FME Form/Flow. Maybe somebody can help me.

I have a workspace that has multiple PostgresSQL readers, and these readers have a reference to the User Parameter in the WHERE clause.

This workspace is published to FME Flow and triggered by an Amazon SQS trigger. The SQS message content is a JSON with parameters that are required for the readers in the workspace.

My question is, how do I pass/parse incoming content to separate parameters in the workspace?

@ohumeniuk,

Thanks for the question.
Can I assume the incoming message from SQS has the information you want in the ‘message body’ of the message vs ‘message attributes’?

Is it a single value or multiple?

example single value:

{“mywhere1”:”id=1”}

Let’s say the example above is close to yours.


Option 1:

If so, your workspace will need to ingest the message content, and this will be json formatted. 
1) You’ll need to create published parameter in the target workspace of type text. This will be used to pass the message from SQS to the workspace in the automation (see “JSON Where Clause” below).  

2) Back in the workspace, start with a Creator, then use a JSONFlattener to turn the json content into an attribute. This will give you mywhere1 with a value of id=1 (based on my json example above).

3) Next you’ll need to feed this into a FeatureReader(s) for your PostgreSQL formats and use the new attribute as the Where Clause (mywhere1)

  

Let me know if that helps.

 

Option 2 - failing at moment: I tried another way, which was to have a JSON Reader in the workspace receive the message content but it was treating the content as a file and not working. I think this is user error on my behalf and will seek to follow up on that.  But basically you’d still need to use FeatureReaders to make use of the data coming in.

Option 3 - Python: Another more involved alternative could be python and scripted parameters.
The workspace you have now could also be tweaked to make use of a Scripted Parameter that could read the incoming message content and then be used to populate another published parameter that could then be used in the Reader Where Clause (note that the where clause is on the Reader and each Feature Type).  I don’t have an example of this readily available.  Someone else might though (any takers?).

 

I’ll see if any other colleagues have more elaborate examples.


Reply