corda / net.corda.core.flows / FlowSession / <init>

<init>

FlowSession()

A FlowSession is a handle on a communication sequence between two paired flows, possibly running on separate nodes. It is used to send and receive messages between the flows as well as to query information about the counter-flow.

There are two ways of obtaining such a session:

  1. Calling FlowLogic.initiateFlow. This will create a FlowSession object on which the first send/receive operation will attempt to kick off a corresponding InitiatedBy flow on the counterparty's node.
  2. As constructor parameter to InitiatedBy flows. This session is the one corresponding to the initiating flow and may be used for replies.

To port flows using the old Party-based API:

Look for Deprecated usages of send/receive/sendAndReceive/getFlowInfo.

If it's an InitiatingFlow:

Look for the send/receive that kicks off the counter flow. Insert a

    val session = initiateFlow(party)

and use this session afterwards for send/receives. For example: send(party, something) will become session.send(something)

If it's an InitiatedBy flow:

Change the constructor to take an otherSideSession: FlowSession instead of a counterparty: Party Then look for usages of the deprecated functions and change them to use the FlowSession For example: send(counterparty, something) will become otherSideSession.send(something)