Workflow implementation for Financial Txn (Payment Gateway/Switch)

Hi Team,

We want to implement workflow orchestrator to perform financial transactions which will connect to different issuer/acquirer/switch.

Requirement -

  1. Low latency and should be scaled depending on traffic or number of txn.
  2. Workflow definition should be configurable. Business can change flow of txn at any time.
  3. We have to call external APIs in few scenarios. (could be sync or async)
  4. We are thinking to have separate workflow for each type of transaction.
  5. If txn request if coming from different merchants/acquirer then each merchant should have separate worker? What are the best practices to create multiple workers?

Could you please let us know how Temporal can be help to implement this.

  1. From the server side, Temporal server roles are stateless and can be scaled horizontally. Fine tuning performance and decreasing latencies often in addition to fine-tuning server, includes scaling and performance tuning your applications, especially the workers that execute your workflow code. For persistence, Temporal does support Cassandra where you can also achieve horizontal scaling. Making sure you properly scale your persistence is important as scalability of a Temporal cluster depends on “state transitions” (db updates/second).

You should be able to achieve very low latencies depending on your setup but you do of course need to run load testing and the fine-tune things accordingly.

  1. Yes, you can introduce changes to your workflow code (orchestration logic) without affecting running executions via versioning for example. Temporal also allows you to async update the workflow state via outside events - signals.

  2. Yes you can call external apis via activities. Activities can be invoked sync or async. The actual implementation of calling external apis can be as you wish (you control the code).

  3. You can execute very large numbers (some uses cares have hundreds of millions) concurrently running workflows and they can have different workflow types.

  4. With Temporal a workflow execution is not tied to a particular worker. A workflow execution is specified to a namespace and a task queue. For your user case I assume you wish to have a task queue per merchant, assume because you would want to apply different rate limits? Please describe your use case if you can for this requirement.
    As far as workers goes you would want to have multiple worker processes (pods for example) for resiliency and fault tolerance. If one worker process (pod) goes down your executions would be able to continue on a separate worker. Typically you would want to start off with a single worker per task queue and then scale up your worker fleet according to observed SDK and server metrics. More info here and here.