jakeMantle
jakeMantle

Reputation: 189

Should I used Orchestration or Choreography pattern?

I am currently developing a service and its current architecture is monolithic. So, when a client clicks, the front end connects with the backend service. On the backend, currently it is designed in such a way that it calls a master method which then manages other methods sequentially waiting for its response. The API calling the master would start a thread and give HTTP response as 202 immediately. Currently the backend is in single pod. Logic is something like

master(request):
      m1 = callMethod1(request)
      if m1.message == 'OK':
           m2 = callMethod2(request)
           if m2.message == 'OK':
              m3 = callMethod3(request)
              
              #around 10 methods like this
      else:
           #fail

callMethod1(request):
    #do something with request
    #update database
    #return the status 

callMethod2(request):
    #do something with request
    #update database if pass(OK) or fail(ERROR)
    #return the status 

Concurrent users for this application would be not more than 150.

Tech stack:

  1. Front end - React
  2. Backend - Django

My questions:

  1. Should I convert each methods to an API and put it in individual pods?
  2. If so, what pattern do I use, orchestration or choreography?
  3. If choreography, what is an cost efficient way to do the publisher - subscriber functionality? Redis or Service Bus?
  4. Or should I just stick to the present architecture?

Upvotes: 0

Views: 255

Answers (1)

Maxim Fateev
Maxim Fateev

Reputation: 6890

This use case looks simpler using orchestration. Check out the temporal.io open source project that would allow converting your code to a workflow withou logical changes.

Upvotes: 0

Related Questions