Solved

How could I send notifications from a scheduled job (15 seconds)?


Badge +1

Hi, I have a workspace that is retrieving me data from an API every 15 seconds, thus I can have a web app that can read the messages trough a websocket and then display the info on a map (similar to the FME demo: http://demos.fmeserver.com/spatialdashboard/index.html ) In my case, I am not using it to show moving objects but to locate earthquakes, and the interval only allows to keep my data up to date. Now if I want to send a notification via email, for example with earthquakes reaching a certain magnitude, how can I prevent my notification from being triggered every 15 seconds and instead only send notifications once per event? Thanks

icon

Best answer by siennaatsafe 7 August 2021, 01:17

View original

6 replies

Badge +9

Hi @juandiegoboh​ ,

 

I think the solution will depend on how you are running your workspace and what version of FME Server you are using, is it just one constantly running workspace in something like Streams or are you using the WebSocket trigger in FME Server Automations? Would you mind providing those details and I'll try to figure out a way to handle this?

Badge +1

Hi @juandiegoboh​ ,

 

I think the solution will depend on how you are running your workspace and what version of FME Server you are using, is it just one constantly running workspace in something like Streams or are you using the WebSocket trigger in FME Server Automations? Would you mind providing those details and I'll try to figure out a way to handle this?

Thanks for the answer @siennaatsafe​. Well let me explain a little, I am running my workspace as an automation that starts as a scheduled initiated, every 15 seconds, it is not really like a stream because my data is not changing that fast, it is just adding a new earthquake every few seconds/minutes, so I am not using streams or the web socket trigger in the automation, I just use the web socket sender in the workspace and it is readed on the browser by my mapping application in the js code. I took this workflow from the live spatial dashboard demo, specifically from the bus dataset, which was the one that most closely resembled my data in this case. I am using the latest version of FME Server (2021.1).

Badge +9

Thanks for the answer @siennaatsafe​. Well let me explain a little, I am running my workspace as an automation that starts as a scheduled initiated, every 15 seconds, it is not really like a stream because my data is not changing that fast, it is just adding a new earthquake every few seconds/minutes, so I am not using streams or the web socket trigger in the automation, I just use the web socket sender in the workspace and it is readed on the browser by my mapping application in the js code. I took this workflow from the live spatial dashboard demo, specifically from the bus dataset, which was the one that most closely resembled my data in this case. I am using the latest version of FME Server (2021.1).

I think you could best accomplish this with a few workspaces. First, your earthquake workspace will run. This could use an automation writer to determine if the earthquake is reaching a certain magnitude.

 

Then, you can have a workspace that checks an excel file that would contain details if an email has been sent out recently. If no email has been sent out then you can go to the email node. Again, you can use an automation writer here with the output if you'd like to send the email.

 

Finally, after the email has been sent, you can have another workspace to log a message to an excel file with a timestamp. This is the excel file you'd check in the "rate limiting" workspace to see if you should send an email or not.

 

Hopefully, that makes sense! Let me know if you have any questions.

Screen Shot 2021-08-06 at 4.05.42 PM

Badge +1

Thanks for the answer @siennaatsafe​. Well let me explain a little, I am running my workspace as an automation that starts as a scheduled initiated, every 15 seconds, it is not really like a stream because my data is not changing that fast, it is just adding a new earthquake every few seconds/minutes, so I am not using streams or the web socket trigger in the automation, I just use the web socket sender in the workspace and it is readed on the browser by my mapping application in the js code. I took this workflow from the live spatial dashboard demo, specifically from the bus dataset, which was the one that most closely resembled my data in this case. I am using the latest version of FME Server (2021.1).

Thank you @siennaatsafe (Safer)​ ​ I like your approach, and it seems clear for me, actually, I was also thinking about something similar to this, I just have one additional question with that implementation, in the second workspace, where I read the excel, do I have to use a change detector to compare the logs of the emails with the events that are coming from the first workspace? Or how I would know if the emails that were sent doesn't correspond to the events I am receiving every 15 seconds?

Badge +9

Thanks for the answer @siennaatsafe​. Well let me explain a little, I am running my workspace as an automation that starts as a scheduled initiated, every 15 seconds, it is not really like a stream because my data is not changing that fast, it is just adding a new earthquake every few seconds/minutes, so I am not using streams or the web socket trigger in the automation, I just use the web socket sender in the workspace and it is readed on the browser by my mapping application in the js code. I took this workflow from the live spatial dashboard demo, specifically from the bus dataset, which was the one that most closely resembled my data in this case. I am using the latest version of FME Server (2021.1).

Hi @juandiegoboh​ ,

 

After the email has been sent, you'll record information about the event and a timestamp in the excel sheet using the third workspace.

 

I guess the logic of your rate limiter workspace (the second one) would depend on what your data is like. Is it clear what is a single event? Would the numbers in the same event be constantly changing? I was thinking originally, you could use a matcher. This would help you compare if you sent out an email related to the same event. Then you could check with the timestamp if you recently sent out the email.

 

Does that make sense?

Badge +1

Thanks for the answer @siennaatsafe​. Well let me explain a little, I am running my workspace as an automation that starts as a scheduled initiated, every 15 seconds, it is not really like a stream because my data is not changing that fast, it is just adding a new earthquake every few seconds/minutes, so I am not using streams or the web socket trigger in the automation, I just use the web socket sender in the workspace and it is readed on the browser by my mapping application in the js code. I took this workflow from the live spatial dashboard demo, specifically from the bus dataset, which was the one that most closely resembled my data in this case. I am using the latest version of FME Server (2021.1).

Yes it make sense, the numbers in the same event are not going to change so I can perform a match at the beginning of the workspace and know if I have sent the email alert yet or not. Thanks @siennaatsafe​  for the ideas you shared, it has been very useful.

Reply