Solved

Notifications - how to run a workspace on FME Server 2018 using parameter from Directory Watch

  • 14 April 2022
  • 3 replies
  • 3 views

Badge +1

I have a directory watch on a network folder and I can successfully trigger the subscription by adding a file to that folder. I can see that the workspace is triggered as well. However, what I'm still trying to figure out is how to pass the path and file name of the zip file placed in it to the workspace.

 

What would the input parameter need to be set as in the workspace? Currently I have it set to a published user parameter with no default value.

 

ZipExtractorIn the subscription configuration, the "Source Zip File" parameter is set to "Get Value from Topic Message". However, that parameter evaluations to the path of the JSON file created with the topic is published to, not the zip file path. From the log:

FME Configuration: Command line arguments are `fme' `Test\\LaTaxTableImportForDirectoryWatcherWBR\\LaTaxTableImportForDirectoryWatcherWBR.fmw' `--SourceZip' `$(FME_SHAREDRESOURCE_SYSTEM)temp/subscriptions/c2177f37ebd94805bd9717d51d228e46.json' `--FME_TOPIC_MESSAGE' `$(FME_SHAREDRESOURCE_SYSTEM)temp/subscriptions/c2177f37ebd94805bd9717d51d228e46.json' `--FME_SECURITY_USER' `Lance' `--FME_MF_NAME' `LaTaxTableImportForDirectoryWatcherWBR.fmw' `--FME_SERVER_HOST' `localhost' `--FME_SERVER_PORT' `7071' `--FME_TOPIC' `WBR_Conversion_Tool'

 

What am I doing wrong?

 

icon

Best answer by markw 19 April 2022, 18:29

View original

3 replies

Badge +1

Hm, I thought this would be an easy one 😁

 

Maybe I'm asking it wrong. Basically, how do I get/pass the path and filename of the zip file that was placed in the directory that triggered the directory watch to fire? That is the name of the file used in triggered workspace.

Badge

Hi @lancec​, my apologies for the late response!

 

When your WBR_Conversion_Tool topic receives a notification that a ZIP file was received, the message contents are passed through a JSON file as seen in the log. This file contains the path to the detected ZIP file and other information from the Directory Watch publisher. To read the message contents, your workspace will need a Text or JSON reader and path parameter (with Get Value From Topic Message selected). The workspace will need to read the JSON file, parse out the directory watcher information including the incoming ZIP path, and then pass that ZIP path into the ZIPExtractor.

 

My suggestion for creating the first section of the workspace that reads/parses the topic message is to download one of the generated .json files from FME Server as a template. For example, you can find them in Files & Connections > Resources > System > temp > subscriptions > c2177f37ebd94805bd9717d51d228e46.json

 

I'd also suggest following this tutorial for step-by-step instructions since it has downloadable workspaces as examples: https://community.safe.com/s/article/directory-watch-publisher-tutorial-2017 I hope this helps!

Badge +1

Hi @lancec​, my apologies for the late response!

 

When your WBR_Conversion_Tool topic receives a notification that a ZIP file was received, the message contents are passed through a JSON file as seen in the log. This file contains the path to the detected ZIP file and other information from the Directory Watch publisher. To read the message contents, your workspace will need a Text or JSON reader and path parameter (with Get Value From Topic Message selected). The workspace will need to read the JSON file, parse out the directory watcher information including the incoming ZIP path, and then pass that ZIP path into the ZIPExtractor.

 

My suggestion for creating the first section of the workspace that reads/parses the topic message is to download one of the generated .json files from FME Server as a template. For example, you can find them in Files & Connections > Resources > System > temp > subscriptions > c2177f37ebd94805bd9717d51d228e46.json

 

I'd also suggest following this tutorial for step-by-step instructions since it has downloadable workspaces as examples: https://community.safe.com/s/article/directory-watch-publisher-tutorial-2017 I hope this helps!

Thanks Mark. It was the JSON Reader that I needed. I had read the article and watch the videos, as well as downloaded the sample workspaces before but for some reason they just didn't click with me. I was probably overthinking it. Your simple explanation helped make it clear.

 

Thanks again.

Reply