Skip to main content

Does the FeatureMerger actually work as a blocking transformer when no features reach the Requestor port?

 

I mean, for example in the workblow below, I assume the Creator transformer will go first but after that, will it read the json file, wait to see if any feature enters the Requestor port and then go on through the rest of the flow?

 

workflow 

I'm reading and writing the same json file so it's critical to know. It works as expected so far but if anyone knowing for sure could confirm I would appreciate.

Hi @dms2​,

In the configuration you have now, the No Check Needed features will skip the FeatureMerger and could arrive at the JSON writer before the JSON reader is finished. For safety, you may want to add a FeatureHolder right before the output JSON feature type. This will ensure that all features are read from the JSON reader before writing starts.


Actually there's just one feature so a FeatureHolder would be useless.

 

So you mean that if the (one and only) feature goes through the No Check Needed port there's no guarantee that the JSON file will be read before it is written?

Ok, your answer makes me realize what my actual question is: if the feature goes through the No Check Needed port and therefore the writing is not dependant on the reading of the JSON file, may the reading and writing of the JSON file interfere each other (no matter which one goes first)? That is, may the file be read before the writing is done making the writing fail?

I could create a fake No Check Needed feature and block the writing until both features reach the JSON writer but I don't want to add unnecessary transformers to the workspace.


You can postpone reading the JSON file until after you have determined you need its contents.

Alternative_workflow_JSON


You can postpone reading the JSON file until after you have determined you need its contents.

Alternative_workflow_JSON

@geomancer​ I'm not a fan of the FeatureReader transformer but it does resolve the eventual problem I guess.

Still in doubt about the reading and writing interference though. My guess is that the opening/closing of the file could be the source of a possible failure and not the reading/writing by themselves.


You can postpone reading the JSON file until after you have determined you need its contents.

Alternative_workflow_JSON

When I first started with FME, I felt the same way about the FeatureReader. But the FeatureReader is much more flexible than Readers, it just takes some getting used to.

Doing a quick test on reading a file with a FeatureReader, and immediately overwriting the same file with a Writer, I get no error messages, and the file is overwritten correctly.

 


Reply