-1

I have a use case where I need to process a request as follows

  1. Authenticate the Request
  2. Authorize the Request
  3. Validate the message (Reads the database for the existing record and validates it)
  4. Perform some asynchronous operations
  5. Update the records in the database and notify the customer

The problem is I need to read the same record we read in step 3 in step 4 and step 5 Since this looked like a workflow I thought I can use the COR design pattern. However I do not want to read the database record again in step 4 and 5 and want to pass this from step 3 to step 4 and 5.

What is an elegant design pattern I can use for this workflow. Can you help me with giving some class/interface structure for this?

null
  • 3,546
  • 1
  • 11
  • 21
  • 3
    Possible duplicate of [Choosing the right Design Pattern](https://softwareengineering.stackexchange.com/questions/227868/choosing-the-right-design-pattern) – gnat Jun 20 '18 at 08:22
  • ...also, please don't **[cross-post](https://meta.stackexchange.com/tags/cross-posting/info "'Cross-posting is frowned upon'")**: https://stackoverflow.com/questions/50943147/design-pattern-for-a-sequence-of-related-operations "Cross-posting is frowned upon as it leads to fragmented answers splattered all over the network..." – gnat Jun 20 '18 at 08:23
  • ok i posted here as suggested there. and this is not a duplicate of the first quetion u linked – Sriram Manohar Jun 20 '18 at 08:25

1 Answers1

0

The elegant design pattern to use for such case is Chain Of responsibility , so you can define a sequence of steps or actors to process a request .