FlowSession

@DoNotImplement
interface 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. Sessions have their own local flow context which can be accessed via getContextProperties. Note that the parent context is snapshotted at the point getContextProperties is first accessed, after which no other changes to the parent context will be reflected in them. See getContextProperties for more information.

There are two ways of obtaining such a session:

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

See also

Functions

Link copied to clipboard
@Suspendable
abstract fun close()
Closes this session and performs cleanup of any resources tied to this session.
Link copied to clipboard
Link copied to clipboard
@NotNull
abstract fun getCounterparty(): MemberX500Name
The MemberX500Name of the counterparty this session is connected to.
Link copied to clipboard
@Suspendable
@NotNull
abstract fun getCounterpartyFlowInfo(): FlowInfo
Returns a [FlowInfo] object describing the flow which the [counterparty] is running.
Link copied to clipboard
@Suspendable
@NotNull
abstract fun <R> receive(@NotNull receiveType: Class<R>): R
Suspends until a message of type is received from .
Link copied to clipboard
@Suspendable
abstract fun send(@NotNull payload: Any)
Queues the given payload for sending to getCounterparty and continues without suspending.
Link copied to clipboard
@Suspendable
@NotNull
abstract fun <R> sendAndReceive(@NotNull receiveType: Class<R>, @NotNull payload: Any): R
Serializes and queues the given payload object for sending to getCounterparty.