Scenario- After request validation, I will need to
-
Call database and update the record. Based on a certain condition, I will be calling Service1.
-
Upon performing this step, I will call another database and update record from the request.
-
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
- Where ever the operation breaks/exception is generated, code should stop its execution.
- Under single Logging object, I am having difficulty to handle the sequential call.
- 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