Skip to main content
Solved

How do I get the "Content" out of the trigger "FME Server Topic Notified"

  • August 27, 2021
  • 4 replies
  • 138 views

braggken
Supporter
Forum|alt.badge.img+7

Embarrassed to be asking this but in an FME Server Automation how do I get just the raw the "Content" from the trigger FME Server Topic Notified. We have the various keys but none of them seem to correspond directly to the Content of the notification.

Please don't tell me Content has to be Json keys! 😅

Automation

 

In the workspace the FME Server Notifier has a Content parameter so

Best answer by hollyatsafe

I guess I may have answered my own question.

Looks like you must send JSON to the FMEServerNotifier and the attributes are accessible in the automation as user keys.

So if the JSON looks like this:

{

  "EmailSubject" : fme:get-attribute("EmailSubject"), 

  "html_content" : fme:get-attribute("html_content")

}

 

Then in the FME Server Topic trigger you create user keys like this:

User.EmailSubject = {EmailSubject}

html_content = {html_content}

 

I would really prefer to be able to access the raw Content in the automation if anyone can see a way to do that?

Hi @braggken​ ,

 

All the FME Server Automation protocols parse messages as a string of JSON. Using the FMEServerNotifier transformer you can set the Content to send a string of JSON e.g.

 

{"key1":"helloworld"}

 

But you can also set the Content to plain text, if you do this it will still get stored as JSON but under a key with the name subscriber_content e.g.

 

{"subscriber_content":"helloworld"}

 

To use any portion of an event JSON string downstream in an Automation you do not need to create a new key, but wrap the key name in curly brackets and it will fetch the correct value e.g. {key1} or {subscriber_content}.

 

This was actually a great question, topics are a little funny and behave differently from all the other protocols because the user has full control over the message contents so FME can't expose the keys by default. That being said, I think it would be helpful to expose the subscriber_content key so I am going to file an enhancement request for consideration by our development team.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

braggken
Supporter
Forum|alt.badge.img+7
  • Author
  • Supporter
  • 32 replies
  • August 30, 2021

I guess I may have answered my own question.

Looks like you must send JSON to the FMEServerNotifier and the attributes are accessible in the automation as user keys.

So if the JSON looks like this:

{

  "EmailSubject" : fme:get-attribute("EmailSubject"), 

  "html_content" : fme:get-attribute("html_content")

}

 

Then in the FME Server Topic trigger you create user keys like this:

User.EmailSubject = {EmailSubject}

html_content = {html_content}

 

I would really prefer to be able to access the raw Content in the automation if anyone can see a way to do that?


Forum|alt.badge.img+2
  • 719 replies
  • Best Answer
  • August 30, 2021

I guess I may have answered my own question.

Looks like you must send JSON to the FMEServerNotifier and the attributes are accessible in the automation as user keys.

So if the JSON looks like this:

{

  "EmailSubject" : fme:get-attribute("EmailSubject"), 

  "html_content" : fme:get-attribute("html_content")

}

 

Then in the FME Server Topic trigger you create user keys like this:

User.EmailSubject = {EmailSubject}

html_content = {html_content}

 

I would really prefer to be able to access the raw Content in the automation if anyone can see a way to do that?

Hi @braggken​ ,

 

All the FME Server Automation protocols parse messages as a string of JSON. Using the FMEServerNotifier transformer you can set the Content to send a string of JSON e.g.

 

{"key1":"helloworld"}

 

But you can also set the Content to plain text, if you do this it will still get stored as JSON but under a key with the name subscriber_content e.g.

 

{"subscriber_content":"helloworld"}

 

To use any portion of an event JSON string downstream in an Automation you do not need to create a new key, but wrap the key name in curly brackets and it will fetch the correct value e.g. {key1} or {subscriber_content}.

 

This was actually a great question, topics are a little funny and behave differently from all the other protocols because the user has full control over the message contents so FME can't expose the keys by default. That being said, I think it would be helpful to expose the subscriber_content key so I am going to file an enhancement request for consideration by our development team.

 


braggken
Supporter
Forum|alt.badge.img+7
  • Author
  • Supporter
  • 32 replies
  • August 31, 2021

Thanks for your answer @hollyatsafe​  I didn't know about this "subscriber_content" so that's definitely helpful! And yes it would be great if that was a key you could see in the Notifier trigger. Also, and maybe I missed it, but I didn't see documentation on either using the json keys (I just kind of guessed on that) or the "subscriber_content" with the FME Server Automations Trigger here.

Might be good to have this documented on one of these two places:

https://docs.safe.com/fme/html/FME_Server_Documentation/WebUI/Automations-Triggers/Trigger-Topic.htm

https://docs.safe.com/fme/html/FME_Server_Documentation/WebUI/Automations-General/Working-with-Output-Keys-in-Workflows.htm

 


Forum|alt.badge.img+2
  • 719 replies
  • September 1, 2021

Thanks for your answer @hollyatsafe​  I didn't know about this "subscriber_content" so that's definitely helpful! And yes it would be great if that was a key you could see in the Notifier trigger. Also, and maybe I missed it, but I didn't see documentation on either using the json keys (I just kind of guessed on that) or the "subscriber_content" with the FME Server Automations Trigger here.

Might be good to have this documented on one of these two places:

https://docs.safe.com/fme/html/FME_Server_Documentation/WebUI/Automations-Triggers/Trigger-Topic.htm

https://docs.safe.com/fme/html/FME_Server_Documentation/WebUI/Automations-General/Working-with-Output-Keys-in-Workflows.htm

 

@braggken​ ,

 

Great point, I've requested some updates to our documentation. Thanks!