Skip to main content
Question

REST API - Run Job/Workspace with Notification by FMEServerEmailGenerator


Forum|alt.badge.img

Hi,

 

 

I have a problem with the fmerest/v3/transformations/submit service and I hope someone can help me. I have a very simple worflow set up in my fme-server process. 

Creator -> FMEServerEmailGenerator -> TextFileWriter

I have set up Topic and Subscription as described and configured my FMEServerEmailGenerator with the right topic.

 

 

Now I can invoke my process over fme-server gui successfully but if I do it via rest, I dont receive an email anymore. From my understanding the email configuration should be done by the transformer in this case, so sending my necessary published parameters should be enougth:
{"publishedParameters":[{"name":"uploadMeasures","value":"No"},{"name":"uploadDailyAverages","value":"No"},{"name":"test","value":"Yes"},{"name":"testEmail","value":"foo@bar.com"},{"name":"DestDataset_TEXTLINE","value":"$(FME_SHAREDRESOURCE_DATA)/output.json"}]}

But somehow its not. In my results under request data I'm missing notification manager directives sections. So I had to google because I didn't found an example on this in the api docs (run process with notification).

 

 

Now I added 

"NMDirectives":{"failureTopics":["FLIESSGEWAESSER_TEST"],"successTopics":["FLIESSGEWAESSER_TEST"]}

 

 

into my rest body abd now I receive an email but all settings of my FMEServerEmailGenerator are missing like template and title -> empty mail.

 

 

Can someone please help me? I'm loosing to much time on this.

 

 

Thank you

8 replies

david_r
Evangelist
  • August 28, 2018

I know it's not exactly what you're asking, but have you considered using the Emailer transformer? Much easier to use, in my opinion.


Forum|alt.badge.img
  • Author
  • August 28, 2018
david_r wrote:

I know it's not exactly what you're asking, but have you considered using the Emailer transformer? Much easier to use, in my opinion.

I'm open for alternatives. Is it possible to configure Emailer to let fme-server do the job? Because this is what I would like to have. This is just a test configuration where I want to invoke my workbench and somehow give the requestor a simple message as feedback. I thought email would be easiest way because there are these build in solutions like FMEServerEmailGenerator or FMEServerNotifier but maybe I was wrong.

 

 


david_r
Evangelist
  • August 28, 2018

If you want to use the FMEServerEmailGenerator, you need to send the output to the FMEServerNotifier, triggering your outgoing email topic with the content set to the output from the FMEServerEmailGenerator.


Forum|alt.badge.img
  • Author
  • August 28, 2018
david_r wrote:

If you want to use the FMEServerEmailGenerator, you need to send the output to the FMEServerNotifier, triggering your outgoing email topic with the content set to the output from the FMEServerEmailGenerator.

 

This works if I run my workbench locally but I'm publishing this as a service to fme-server. So far I had the FMEServerEmailGenerator set up as described in the main message according to the documentation and was able to start the process on the server with email notification.

david_r
Evangelist
  • August 28, 2018
jscope wrote:

 

This works if I run my workbench locally but I'm publishing this as a service to fme-server. So far I had the FMEServerEmailGenerator set up as described in the main message according to the documentation and was able to start the process on the server with email notification.
Not sure I understand, that pattern should work on FME Server as well. In fact, it was the way I always did it before the Emailer was introduced.

Forum|alt.badge.img
  • Author
  • August 28, 2018
david_r wrote:
Not sure I understand, that pattern should work on FME Server as well. In fact, it was the way I always did it before the Emailer was introduced.

 

Okay, just to be sure I understood you correctly :) because I`m not a fme expert.

 

 

I have some transformer providing a text attribute. I give it as input to my FMEServerEmailGenerator which has following settings:

 

 

To: target email from published parameter

 

CC: some other email

 

Subject: some text

 

Content: my template with another published parameter build in

 

 

I send the output of FMEServerEmailGenerator to FMEServerNotifier with following parameters:

 

 

connection: connection to our fme-server pre-configured for us

 

topic: my topic

 

content: text_line_data attribute created by FMEServerEmailGenerator

 

 

Now when I publish my workspace I have to configure Job Submitter service and I don't have a writer anymore what are the settings in Edit... after Job Submitter.

 

 

I only receive emails if I set a topic here under "post topics on success" but in your setup FMEServerNotifier should do that right?

david_r
Evangelist
  • August 28, 2018
jscope wrote:

 

Okay, just to be sure I understood you correctly :) because I`m not a fme expert.

 

 

I have some transformer providing a text attribute. I give it as input to my FMEServerEmailGenerator which has following settings:

 

 

To: target email from published parameter

 

CC: some other email

 

Subject: some text

 

Content: my template with another published parameter build in

 

 

I send the output of FMEServerEmailGenerator to FMEServerNotifier with following parameters:

 

 

connection: connection to our fme-server pre-configured for us

 

topic: my topic

 

content: text_line_data attribute created by FMEServerEmailGenerator

 

 

Now when I publish my workspace I have to configure Job Submitter service and I don't have a writer anymore what are the settings in Edit... after Job Submitter.

 

 

I only receive emails if I set a topic here under "post topics on success" but in your setup FMEServerNotifier should do that right?
If I'm understanding you correctly, you've found one of the "warts" of the notification system (in my opinion), and you're certainly not the first to stumble on this.

 

 

In short: the jobsubmitter service behaves fundamentally different to the REST API.

 

 

Basically, when you publish the workspace and you define the Job Submitter settings in the publication wizard, these settings are only valid for the so-called jobsubmitter service, and not the REST interface. For the REST interface the topics configured for the jobsubmitter are not used and you have to specify them on each job submission via the NMDirectives (as you've seen). Also, you cannot specify that you want a particular writer as topic contents, as you can for the jobsubmitter service.

 

 

Which is why I prefer the Emailer if the email is not used for critical failure notifications: it's consistent and works the same way regardless of where and when :-)

david_r
Evangelist
  • August 28, 2018
jscope wrote:

 

Okay, just to be sure I understood you correctly :) because I`m not a fme expert.

 

 

I have some transformer providing a text attribute. I give it as input to my FMEServerEmailGenerator which has following settings:

 

 

To: target email from published parameter

 

CC: some other email

 

Subject: some text

 

Content: my template with another published parameter build in

 

 

I send the output of FMEServerEmailGenerator to FMEServerNotifier with following parameters:

 

 

connection: connection to our fme-server pre-configured for us

 

topic: my topic

 

content: text_line_data attribute created by FMEServerEmailGenerator

 

 

Now when I publish my workspace I have to configure Job Submitter service and I don't have a writer anymore what are the settings in Edit... after Job Submitter.

 

 

I only receive emails if I set a topic here under "post topics on success" but in your setup FMEServerNotifier should do that right?
To answer your specific question: If you use the FMEServerEmailGenerator + FMEServerNotifier and only invoke the workspace using the REST API, then you can simply ignore the advanced parameters in the publishing wizard, they won't be used anyway.

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings