Today want to share with you some thoughts about how to organize additional processing in Acumatica.
Commonly we may need to to something together with document release: create contract, send EDI request (like inter-company), call 3rd party API and so on.
Most common way to do so is just code infection in the save or release process. Than you do 2 things just together.
However this leads to some troubles:
- Performance – when you do 2 operations simultaneously you have to lock transaction for longer period of time, that finally affects other users as they have to wait.
- Repeating – if operation fails and you have to repeat it you should start the whole process again, that makes it longer.
- Responsibility – with one big process it is not always easy to find what process is responsible for the error – customization or standard.
Personally I have found that the better architecture is to split standard and custom operations in 2 phases:
- Main/Standard processing – you just identify that the record requires an additional processing with custom field flag or status.
- Post-processing or custom processing – you select all records that require processing but were not processed and process them.
The best example of this patter is Inter-Company transactions in one of my previous articles.
- You can automate separate process with schedule or business events trigger.
- You can run background operations on a separate server connected to the same database that won’t affect UI performance. You can use RunScheduleProcessor parameter of web.config file to specify who process operations.
Hope it helps and don’t hesitate to check you architecture with Acumatica team. We always happy to give you and advise!