initiateFlow

@Suspendable
@NotNull
abstract fun initiateFlow(@NotNull x500Name: MemberX500Name): FlowSession

Creates a communication session with a counterparty's ResponderFlow. Subsequently, you may send/receive using this session object. Note that this function does not communicate in itself. The counter-flow will be kicked off by the first send/receive.

Initiated flows are initiated with context based on the context of the initiating flow at the point in time this method is called. The context of the initiating flow is snapshotted by the returned session. Altering the flow context has no effect on the context of the session after this point, and therefore it has no effect on the context of the initiated flow either.

Return

The session.

Parameters

x500Name

The X500 name of the member to communicate with.


@Suspendable
@NotNull
abstract fun initiateFlow(@NotNull x500Name: MemberX500Name, @NotNull sessionConfiguration: FlowSessionConfiguration): FlowSession

Creates a communication session with a counterparty's ResponderFlow. Subsequently, you may send/receive using this session object. Note that this function does not communicate in itself. The counter-flow will be kicked off by the first send/receive.

Initiated flows are initiated with context based on the context of the initiating flow at the point in time this method is called. The context of the initiating flow is snapshotted by the returned session. Altering the flow context has no effect on the context of the session after this point, and therefore it has no effect on the context of the initiated flow either.

Return

The session.

Parameters

x500Name

The X500 name of the member to communicate with.

sessionConfiguration

Session configuration (see FlowSessionConfiguration).


@Suspendable
@NotNull
abstract fun initiateFlow(@NotNull x500Name: MemberX500Name, @NotNull flowContextPropertiesBuilder: FlowContextPropertiesBuilder): FlowSession

Creates a communication session with another member. Subsequently, you may send/receive using this session object. Note that this function does not communicate in itself. The counter-flow will be kicked off by the first send/receive.

This overload takes a builder of context properties. Any properties set or modified against the context passed to this builder will be propagated to initiated flows and all that flow's initiated flows and sub flows down the stack. The properties passed to the builder are pre-populated with the current flow context properties, see FlowContextProperties. Altering the current flow context has no effect on the context of the session after the builder is applied and the session returned by this method, and therefore it has no effect on the context of the initiated flow either.

Example of use in Kotlin. ```Kotlin val flowSession = flowMessaging.initiateFlow(virtualNodeName) { flowContextProperties -> flowContextProperties["key"] = "value" } ``` Example of use in Java. ```Java FlowSession flowSession = flowMessaging.initiateFlow(virtualNodeName, (flowContextProperties) -> { flowContextProperties.put("key", "value"); }); ```

Return

The session.

Parameters

x500Name

The X500 name of the member to communicate with.

flowContextPropertiesBuilder

A builder of context properties.

Throws

if the builder tries to set a property for which a platform property already exists or if the key is prefixed by CORDA_RESERVED_PREFIX. See also FlowContextProperties. Any other exception thrown by the builder will also be thrown through here and should be avoided in the provided implementation, see FlowContextPropertiesBuilder.


@Suspendable
@NotNull
abstract fun initiateFlow(@NotNull x500Name: MemberX500Name, @NotNull sessionConfiguration: FlowSessionConfiguration, @NotNull flowContextPropertiesBuilder: FlowContextPropertiesBuilder): FlowSession

Creates a communication session with another member. Subsequently, you may send/receive using this session object. Note that this function does not communicate in itself. The counter-flow will be kicked off by the first send/receive.

This overload takes a builder of context properties. Any properties set or modified against the context passed to this builder will be propagated to initiated flows and all that flow's initiated flows and sub flows down the stack. The properties passed to the builder are pre-populated with the current flow context properties, see FlowContextProperties. Altering the current flow context has no effect on the context of the session after the builder is applied and the session returned by this method, and therefore it has no effect on the context of the initiated flow either.

Example of use in Kotlin. ```Kotlin val sessionConfig = FlowSessionConfiguration.Builder().requireClose(false).build() val flowSession = flowMessaging.initiateFlow(virtualNodeName, sessionConfig) { flowContextProperties -> flowContextProperties["key"] = "value" } ``` Example of use in Java. ```Java FlowSessionConfiguration sessionConfig = new FlowSessionConfiguration.Builder().requireClose(false).build(); FlowSession flowSession = flowMessaging.initiateFlow(virtualNodeName, sessionConfig, (flowContextProperties) -> { flowContextProperties.put("key", "value"); }); ```

Return

The session.

Parameters

x500Name

The X500 name of the member to communicate with.

sessionConfiguration

Session configuration (see FlowSessionConfiguration).

flowContextPropertiesBuilder

A builder of context properties.

Throws

if the builder tries to set a property for which a platform property already exists or if the key is prefixed by CORDA_RESERVED_PREFIX. See also FlowContextProperties. Any other exception thrown by the builder will also be thrown through here and should be avoided in the provided implementation, see FlowContextPropertiesBuilder.


@Suspendable
@NotNull
abstract fun initiateFlow(@NotNull x500Name: MemberX500Name, requireClose: Boolean): FlowSession

Deprecated

Since version 5.2

Creates a communication session with a counterparty's ResponderFlow. Subsequently, you may send/receive using this session object. Note that this function does not communicate in itself. The counter-flow will be kicked off by the first send/receive.

Initiated flows are initiated with context based on the context of the initiating flow at the point in time this method is called. The context of the initiating flow is snapshotted by the returned session. Altering the flow context has no effect on the context of the session after this point, and therefore it has no effect on the context of the initiated flow either.

Deprecated

UseinitiateFlow instead.

Return

The session.

Parameters

x500Name

The X500 name of the member to communicate with.

requireClose

When set to true, the initiated party will send a close message after calling FlowSession.close() and the initiating party will suspend and wait to receive the message when they call FlowSession.close(). When set to false the session is marked as terminated immediately when close() is called.


@Suspendable
@NotNull
abstract fun initiateFlow(@NotNull x500Name: MemberX500Name, requireClose: Boolean, @NotNull flowContextPropertiesBuilder: FlowContextPropertiesBuilder): FlowSession

Deprecated

Since version 5.2

Creates a communication session with another member. Subsequently, you may send/receive using this session object. Note that this function does not communicate in itself. The counter-flow will be kicked off by the first send/receive.

This overload takes a builder of context properties. Any properties set or modified against the context passed to this builder will be propagated to initiated flows and all that flow's initiated flows and sub flows down the stack. The properties passed to the builder are pre-populated with the current flow context properties, see FlowContextProperties. Altering the current flow context has no effect on the context of the session after the builder is applied and the session returned by this method, and therefore it has no effect on the context of the initiated flow either.

Example of use in Kotlin. ```Kotlin val flowSession = flowMessaging.initiateFlow(virtualNodeName) { flowContextProperties -> flowContextProperties["key"] = "value" } ``` Example of use in Java. ```Java FlowSession flowSession = flowMessaging.initiateFlow(virtualNodeName, (flowContextProperties) -> { flowContextProperties.put("key", "value"); }); ```

Deprecated

UseinitiateFlow instead.

Return

The session.

Parameters

x500Name

The X500 name of the member to communicate with.

requireClose

When set to true, the initiated party will send a close message after calling FlowSession.close() and the initiating party will suspend and wait to receive the message when they call FlowSession.close(). When set to false the session is marked as terminated immediately when close() is called.

flowContextPropertiesBuilder

A builder of context properties.

Throws

if the builder tries to set a property for which a platform property already exists or if the key is prefixed by CORDA_RESERVED_PREFIX. See also FlowContextProperties. Any other exception thrown by the builder will also be thrown through here and should be avoided in the provided implementation, see FlowContextPropertiesBuilder.