backgroundworkermessage-queuesoftware-designworker-processiron.io

Delegating Tasks for Mission Critical Application


I'm working on a mission critical application. The application fetches Stock Market data from different stock markets like NYSE, NASDAQ, etc. using third party service. Customers can come to the application and add their Portfolio (which company's shares they have). And then set Alerts. eg. Notify me when AAPL price goes above $xxx on NASDAQ. when MSFT price goes below $zzz on NYSE.

I've a cron job that fetches market data from third party service for all the tickers users have added (AAPL, GOOG, MSFT, etc...) every 1 min. After I get the data, I fetch all the alerts that users have created and then send them notification via Email, SMS, Pushover, Twitter, Facebook Message, etc. Also add that notification to app's database so user can see it in App when they log in.

Now since this is time intensive application, failure to fetch data may result in big loss since customers are paying for the time critical data.

Currently, I'm pushing all the notification sending part to Queue. Worker (on my server) sends notification. Are there any other better ways to delegate as much work as possible to third party servers? Would you recommend using Iron.io worker so it does the job of sending the notifications as well. And may be also fetching data from the market.

Thanks!


Solution

  • Architecturally there are a number of approaches but it sounds as if you're making the right choices. Using a queue to decouple the producer from the notification process makes sense. This enables a more proper SOA architecture where you can change/update/evolve various parts of the app independently without worrying too much about tightly coupled code.

    That said, your question is specifically around offloading to third parties. There are third parties that can abstract the notification part out of your code. I'm not super familiar with them but there are many options: PubNub, Pusher, Twilio, SendGrid, Mailgun, AWS SNS, etc.

    I work for Iron.io. We have many customers doing exactly what you're trying to accomplish: creating workers that become little mini-services and calling them from either push events, scheduled tasks, or on-demand. This frees you up from having to deal with the queuing, routing, scheduling, and worker/background server capacity.

    We're happy to help you architect things right from the beginning, just reach out to support@iron.io.