vendredi 22 mai 2020

Design pattern for multiple DAC and SAC calls

Scenario- After request validation, I will need to

  1. Call database and update the record. Based on a certain condition, I will be calling Service1.

  2. Upon performing this step, I will call another database and update record from the request.

  3. At last I will call audit service to save the transaction details.

This can be achievable in normal code structure. But I am pretty confident there will be plug and play after step 1 or 2, i.e., a database/service call will be introduced in next release after step 1/step 2 (TBD).

I decided to opt for Chain of Responsibility.

Problems

  1. Where ever the operation breaks/exception is generated, code should stop its execution.
  2. Under single Logging object, I am having difficulty to handle the sequential call.
  3. For step 1’s conditional service call, the dynamic modification of the chain of operations is bit complex, as I have to rely on single data type return from the AbstractionHandler.

Is there any alternative design pattern that I can follow?

Aucun commentaire:

Enregistrer un commentaire