Corda FlowLogic Behaviour in a scenario - What is the relevance of threads here?

249 views Asked by At

I was trying to understand the actual flow of flow-logic and sessions.

Consider a scenario in which there are 3 party nodes  A, B and C. At the very onset, A initiates a transaction with B, but B was down at that time. So as far as I understand, it will keep on retrying until B comes back.

  • Whether it is possible for A to initiate another transaction with C at this point of time?

  • I read that open source Corda is single threaded whereas enterprise is multi-threaded, So does this, make a change in the outcome of above scenario?

I have gone through some hints of explicitly making the flow and thread sleep as well. Please shed some light over here!

1

There are 1 answers

5
Adel Rustum On

Corda Open Source:

  • When a flow is suspended (when it calls send(), receive(), sendAndReceive(), or sleep()), the single thread is freed and another flow can be started.
  • When a flow calls an external operation (e.g. HTTP calls, DB calls), that call is blocking; meaning the thread remains locked by the flow until the external call completes and the flow returns. In this case you can't start another flow.
  • Starting Corda 4.4, you can define asynchronous flow operations (read about it here), this puts those long running operations in a separate thread and suspends the flow; making the flow thread available for other flows to start.

Corda Enterprise:

  • As you mentioned, it has multiple flow threads. So the same points above apply, but you have more room to start other flows depending on how many flow threads are available.