Ivica Nedeljkovic

Best way to update external API

Discussion created by Ivica Nedeljkovic on Jul 25, 2016
Latest reply on Jul 28, 2016 by Angel Magana

We are considering developing custom module.  Basic idea is that:

1. user save record(or view record, search module etc...),

2. after record is saved is saved in SugarCRM, return data to ajax call(note that data are not send until end of request)

3. push some data to external API(I guess using server_round_trip logic hook)

4. end request

5. Then in separate action, UI will get some information from 3rd party server, and eventually show some kind of notification to user(this is out of scope for now, we would eventually use long polling or maybe websocket), as soon as it is possible after user saved record

 

My question is about steps 3 and 4. We do not want user to wait until pushing data to external API is done(even if we use some queue mechanism like Amazon SQS or Beanstalk) because it will take some time. We could eventually try to archive something with output buffering and flushing result, but this would probably require some modification to core code.

Another option is to save data that we would need to push to external api into custom database table, and use SugarCRM scheduled job that would run every minute, but the problem is that it would take from 0-60 seconds to send notification to user UI(because cron run every minute).

So ideally would be if we could have some local queue mechanism for this(it would not be problem for our on premise instances, but it is problem with on-demand instances - hosted with SugarCRM), so I wonder what would be best approach to this, in order to avoid any performance degradation when user save record(or perform other actions), and to get data from external API in user UI as soon as possible.

 

We need solution for SUgarCRM 7.7, but it would be nice if it would work with 7.5 and 7.6.

 

I found presentation about New Job Queue from Sugar Uncon 2016, but I don't know when this will be available in Sugar and if it could help.

 

Let me know if something is unclear about my question.

Thanks in advance!!!

Outcomes