From 3be95e207391f1235ff4e24c94b5ee4152afeaf5 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Tue, 12 Dec 2023 13:24:23 +0000 Subject: [PATCH 01/15] CORE-18320 Support for a flow specific timeout on Flow Message API. Client can specify a flow session specific timeout on Flow Message API. If set, it will be passed to the initiated party to also use it. If the client does not provide a timeout value then the value from Corda Configuration is used. --- .../application/messaging/FlowMessaging.java | 75 +++++++++++++++++++ .../messaging/FlowMessagingJavaApiTest.java | 4 +- .../data/flow/state/session/SessionState.avsc | 8 ++ 3 files changed, 85 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java index b83aa6a93d..00814ac3ad 100644 --- a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java @@ -9,6 +9,7 @@ import net.corda.v5.base.types.MemberX500Name; import org.jetbrains.annotations.NotNull; +import java.time.Duration; import java.util.List; import java.util.Map; import java.util.Set; @@ -106,6 +107,29 @@ public interface FlowMessaging { @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose); + /** + * Creates a communication session with a counterparty's {@link 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. + * + * @param x500Name The X500 name of the member to communicate with. + * @param 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. + * @param sessionTimeout The duration that Corda waits when no message has been received from a counterparty before + * causing the session to error. If set to `null`, value set in Corda Configuration will be used. + * + * @return The session. + */ + @Suspendable + @NotNull + FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose, Duration sessionTimeout); + /** * 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 @@ -189,6 +213,57 @@ public interface FlowMessaging { @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose, @NotNull FlowContextPropertiesBuilder flowContextPropertiesBuilder); + /** + * 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 + * {@link 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"); + * }); + * ``` + * + * @param x500Name The X500 name of the member to communicate with. + * @param 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. + * @param sessionTimeout The duration that Corda waits when no message has been received from a counterparty before + * causing the session to error. If set to `null`, value set in Corda Configuration will + * be used. + * @param flowContextPropertiesBuilder A builder of context properties. + * + * @return The session. + * + * @throws IllegalArgumentException if the builder tries to set a property for which a platform property already + * exists or if the key is prefixed by {@link FlowContextProperties#CORDA_RESERVED_PREFIX}. See also + * {@link FlowContextProperties}. Any other + * exception thrown by the builder will also be thrown through here and should be avoided in the provided + * implementation, see {@link FlowContextPropertiesBuilder}. + */ + @Suspendable + @NotNull + FlowSession initiateFlow( + @NotNull MemberX500Name x500Name, + boolean requireClose, + Duration sessionTimeout, + @NotNull FlowContextPropertiesBuilder flowContextPropertiesBuilder + ); + /** * Suspends until a message has been received for each session in the specified {@code sessions}. *

diff --git a/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java b/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java index 20caf32c3b..d4a6fc1669 100644 --- a/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java +++ b/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java @@ -39,7 +39,7 @@ public void initiateFlowPartyWithBuilder() { @Test public void initiateFlowPartyWithBuilderRequireCloseTrue() { final MemberX500Name counterparty = new MemberX500Name("Alice Corp", "LDN", "GB"); - when(flowMessaging.initiateFlow(eq(counterparty), eq(true), any())).thenReturn(flowSession); + when(flowMessaging.initiateFlow(eq(counterparty), eq(true), any(FlowContextPropertiesBuilder.class))).thenReturn(flowSession); FlowSession result = flowMessaging.initiateFlow(counterparty, true, (contextProperties) -> contextProperties.put("key", "value")); @@ -50,7 +50,7 @@ public void initiateFlowPartyWithBuilderRequireCloseTrue() { @Test public void initiateFlowPartyWithBuilderRequireCloseFalse() { final MemberX500Name counterparty = new MemberX500Name("Alice Corp", "LDN", "GB"); - when(flowMessaging.initiateFlow(eq(counterparty), eq(false), any())).thenReturn(flowSession); + when(flowMessaging.initiateFlow(eq(counterparty), eq(false), any(FlowContextPropertiesBuilder.class))).thenReturn(flowSession); FlowSession result = flowMessaging.initiateFlow(counterparty, false, (contextProperties) -> contextProperties.put("key", "value")); diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc index dea2cbcfaa..538f0ff42b 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc @@ -34,6 +34,14 @@ "type": "boolean", "doc": "True if the user has set requireClose to be true when calling initiate flow. False otherwise." }, + { + "name": "sessionTimeout", + "type": [ + "null", + "int" + ], + "doc": "The length of time in milliseconds that Corda waits when no message has been received from a counterparty before causing the session to error. If not set, value from configuration is used." + }, { "name": "receivedEventsState", "type": "net.corda.data.flow.state.session.SessionProcessState", From 98f3c00ef9265401411cf4c6d83dada39e3642cf Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Tue, 12 Dec 2023 13:49:28 +0000 Subject: [PATCH 02/15] CORE-18320 Increased API version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6040cba2d1..3b81a562e9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 12 +cordaApiRevision = 13 # Main kotlinVersion = 1.8.21 From 1cded1a7805607ff73bc8745d5aa5bf72c7f7f84 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Wed, 13 Dec 2023 15:27:35 +0000 Subject: [PATCH 03/15] CORE-18320 Set default value for SessionState.sessionTimeout --- .../avro/net/corda/data/flow/state/session/SessionState.avsc | 1 + 1 file changed, 1 insertion(+) diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc index 538f0ff42b..5dd04e0093 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc @@ -40,6 +40,7 @@ "null", "int" ], + "default": null, "doc": "The length of time in milliseconds that Corda waits when no message has been received from a counterparty before causing the session to error. If not set, value from configuration is used." }, { From 42ccb7efdb12c8326db36df561d87d0705db8a9a Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Thu, 14 Dec 2023 12:41:59 +0000 Subject: [PATCH 04/15] CORE-18320 Using builder to create session configuration. --- .../scans/corda-application-5.2.0.yaml | 3 + .../application/messaging/FlowMessaging.java | 25 +++----- .../messaging/FlowSessionConfiguration.java | 62 +++++++++++++++++++ .../messaging/FlowMessagingJavaApiTest.java | 2 +- 4 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java diff --git a/application/scans/corda-application-5.2.0.yaml b/application/scans/corda-application-5.2.0.yaml index 8c86ca41b3..7047e40e98 100644 --- a/application/scans/corda-application-5.2.0.yaml +++ b/application/scans/corda-application-5.2.0.yaml @@ -1331,6 +1331,9 @@ net.corda.v5.application.messaging.FlowMessaging: requireClose: annotation: [] type: boolean + sessionTimeout: + annotation: [] + type: java.time.Duration flowContextPropertiesBuilder: annotation: - NotNull diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java index 00814ac3ad..8dd2ceedbb 100644 --- a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java @@ -9,7 +9,6 @@ import net.corda.v5.base.types.MemberX500Name; import org.jetbrains.annotations.NotNull; -import java.time.Duration; import java.util.List; import java.util.Map; import java.util.Set; @@ -118,17 +117,13 @@ public interface FlowMessaging { * context of the initiated flow either. * * @param x500Name The X500 name of the member to communicate with. - * @param 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. - * @param sessionTimeout The duration that Corda waits when no message has been received from a counterparty before - * causing the session to error. If set to `null`, value set in Corda Configuration will be used. + * @param sessionConfiguration Session configuration (see {@link FlowSessionConfiguration}). * * @return The session. */ @Suspendable @NotNull - FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose, Duration sessionTimeout); + FlowSession initiateFlow(@NotNull MemberX500Name x500Name, @NotNull FlowSessionConfiguration sessionConfiguration); /** * Creates a communication session with another member. Subsequently, you may send/receive using this session object. @@ -227,24 +222,21 @@ public interface FlowMessaging { *

* Example of use in Kotlin. * ```Kotlin - * val flowSession = flowMessaging.initiateFlow(virtualNodeName) { flowContextProperties -> + * val sessionConfig = FlowSessionConfiguration.Builder().requireClose(false).build() + * val flowSession = flowMessaging.initiateFlow(virtualNodeName, sessionConfig) { flowContextProperties -> * flowContextProperties["key"] = "value" * } * ``` * Example of use in Java. * ```Java - * FlowSession flowSession = flowMessaging.initiateFlow(virtualNodeName, (flowContextProperties) -> { + * FlowSessionConfiguration sessionConfig = new FlowSessionConfiguration.Builder().requireClose(false).build(); + * FlowSession flowSession = flowMessaging.initiateFlow(virtualNodeName, sessionConfig, (flowContextProperties) -> { * flowContextProperties.put("key", "value"); * }); * ``` * * @param x500Name The X500 name of the member to communicate with. - * @param 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. - * @param sessionTimeout The duration that Corda waits when no message has been received from a counterparty before - * causing the session to error. If set to `null`, value set in Corda Configuration will - * be used. + * @param sessionConfiguration Session configuration (see {@link FlowSessionConfiguration}). * @param flowContextPropertiesBuilder A builder of context properties. * * @return The session. @@ -259,8 +251,7 @@ public interface FlowMessaging { @NotNull FlowSession initiateFlow( @NotNull MemberX500Name x500Name, - boolean requireClose, - Duration sessionTimeout, + @NotNull FlowSessionConfiguration sessionConfiguration, @NotNull FlowContextPropertiesBuilder flowContextPropertiesBuilder ); diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java b/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java new file mode 100644 index 0000000000..bbc8be4da4 --- /dev/null +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java @@ -0,0 +1,62 @@ +package net.corda.v5.application.messaging; + +import java.time.Duration; + +/** + * Flow session configuration. Instances should be created using {@link Builder}. + */ +public class FlowSessionConfiguration { + private final boolean requireClose; + private final Duration timeout; + + private FlowSessionConfiguration(Builder builder) { + this.requireClose = builder.requireClose; + this.timeout = builder.timeout; + } + + public boolean isRequireClose() { + return requireClose; + } + + public Duration getTimeout() { + return timeout; + } + + public static class Builder { + private boolean requireClose = true; + private Duration timeout; + + /** + * 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. + * Default value is true. + * @param requireClose Flag that indicates whether close message is required. + * @return {@link Builder}. + */ + public Builder requireClose(boolean requireClose) { + this.requireClose = requireClose; + return this; + } + + /** + * The duration that Corda waits when no message has been received from a counterparty before + * causing the session to error. If set to null, value set in Corda Configuration will be used. + * Default value is null. + * @param timeout Session timeout. + * @return {@link Builder}. + */ + public Builder timeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Builds a new instance of {@link FlowSessionConfiguration}. + * @return a new instance of {@link FlowSessionConfiguration}. + */ + public FlowSessionConfiguration build() { + return new FlowSessionConfiguration(this); + } + } +} diff --git a/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java b/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java index d4a6fc1669..0a5f3e8ad0 100644 --- a/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java +++ b/application/src/test/java/net/corda/v5/application/messaging/FlowMessagingJavaApiTest.java @@ -28,7 +28,7 @@ public void initiateFlowParty() { @Test public void initiateFlowPartyWithBuilder() { final MemberX500Name counterparty = new MemberX500Name("Alice Corp", "LDN", "GB"); - when(flowMessaging.initiateFlow(eq(counterparty), any())).thenReturn(flowSession); + when(flowMessaging.initiateFlow(eq(counterparty), any(FlowContextPropertiesBuilder.class))).thenReturn(flowSession); FlowSession result = flowMessaging.initiateFlow(counterparty, (contextProperties) -> contextProperties.put("key", "value")); From 18f2352dc52b9580cbc4e3df859ad27c59475b8a Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Thu, 14 Dec 2023 17:18:07 +0000 Subject: [PATCH 05/15] CORE-18320 Removed "requireClose" and "sessionTimeout" from SessionState, they will be stored in "sessionProperties". --- application/scans/corda-application-5.2.0.yaml | 3 --- .../data/flow/state/session/SessionState.avsc | 14 -------------- 2 files changed, 17 deletions(-) diff --git a/application/scans/corda-application-5.2.0.yaml b/application/scans/corda-application-5.2.0.yaml index 7047e40e98..8c86ca41b3 100644 --- a/application/scans/corda-application-5.2.0.yaml +++ b/application/scans/corda-application-5.2.0.yaml @@ -1331,9 +1331,6 @@ net.corda.v5.application.messaging.FlowMessaging: requireClose: annotation: [] type: boolean - sessionTimeout: - annotation: [] - type: java.time.Duration flowContextPropertiesBuilder: annotation: - NotNull diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc index 5dd04e0093..605f2ac894 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/flow/state/session/SessionState.avsc @@ -29,20 +29,6 @@ "type": "net.corda.data.identity.HoldingIdentity", "doc": "Identity of the counterparty in the session." }, - { - "name": "requireClose", - "type": "boolean", - "doc": "True if the user has set requireClose to be true when calling initiate flow. False otherwise." - }, - { - "name": "sessionTimeout", - "type": [ - "null", - "int" - ], - "default": null, - "doc": "The length of time in milliseconds that Corda waits when no message has been received from a counterparty before causing the session to error. If not set, value from configuration is used." - }, { "name": "receivedEventsState", "type": "net.corda.data.flow.state.session.SessionProcessState", From 82d970407a158a2e06e8fa3e6da9165fa25bf51b Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Fri, 15 Dec 2023 08:14:38 +0000 Subject: [PATCH 06/15] CORE-18320 Increased APi version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 3b81a562e9..0fafac2a48 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 13 +cordaApiRevision = 14 # Main kotlinVersion = 1.8.21 From dfdf2a19cbb837edd5fe81d0bdcf0ddbb5ab7672 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Fri, 15 Dec 2023 12:30:53 +0000 Subject: [PATCH 07/15] CORE-18320 Increased APi version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ff1e9484eb..a3b10d0770 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 16 +cordaApiRevision = 17 # Main kotlin.stdlib.default.dependency = false From 1b54ea79b21d747c51f3b5861e8dc5fc9d1afdba Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Mon, 18 Dec 2023 08:48:10 +0000 Subject: [PATCH 08/15] CORE-18320 Increased APi version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a3b10d0770..39934097d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 17 +cordaApiRevision = 18 # Main kotlin.stdlib.default.dependency = false From 95d8f7f8254d278f39a010598d464e7e962009a4 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Mon, 18 Dec 2023 08:56:53 +0000 Subject: [PATCH 09/15] CORE-18320 Deprecated FlowMessaging functions that use argument requireClose. --- .../corda/v5/application/messaging/FlowMessaging.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java index 8dd2ceedbb..c36507328d 100644 --- a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java @@ -95,6 +95,9 @@ public interface FlowMessaging { * 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 + * Use {@link FlowMessaging#initiateFlow(MemberX500Name, FlowSessionConfiguration)} instead. + * * @param x500Name The X500 name of the member to communicate with. * @param 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(). @@ -102,6 +105,7 @@ public interface FlowMessaging { * * @return The session. */ + @Deprecated(since = "5.3") @Suspendable @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose); @@ -190,6 +194,10 @@ public interface FlowMessaging { * }); * ``` * + * @deprecated + * Use {@link FlowMessaging#initiateFlow(MemberX500Name, FlowSessionConfiguration, FlowContextPropertiesBuilder)} + * instead. + * * @param x500Name The X500 name of the member to communicate with. * @param 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(). @@ -204,6 +212,7 @@ public interface FlowMessaging { * exception thrown by the builder will also be thrown through here and should be avoided in the provided * implementation, see {@link FlowContextPropertiesBuilder}. */ + @Deprecated(since = "5.3") @Suspendable @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose, @NotNull FlowContextPropertiesBuilder flowContextPropertiesBuilder); From b80aa88ee348cb76ab769124bcd8be67ff526f09 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Mon, 18 Dec 2023 14:02:45 +0000 Subject: [PATCH 10/15] CORE-18320 Deprecated FlowMessaging functions that use argument requireClose. --- .../net/corda/v5/application/messaging/FlowMessaging.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java index c36507328d..dd3b8bb506 100644 --- a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java @@ -105,7 +105,7 @@ public interface FlowMessaging { * * @return The session. */ - @Deprecated(since = "5.3") + @Deprecated(since = "5.2") @Suspendable @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose); @@ -212,7 +212,7 @@ public interface FlowMessaging { * exception thrown by the builder will also be thrown through here and should be avoided in the provided * implementation, see {@link FlowContextPropertiesBuilder}. */ - @Deprecated(since = "5.3") + @Deprecated(since = "5.2") @Suspendable @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose, @NotNull FlowContextPropertiesBuilder flowContextPropertiesBuilder); From e3ac9dfcaa37878c2d1ea7f2102dd3edfcbf602d Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Mon, 18 Dec 2023 19:57:32 +0000 Subject: [PATCH 11/15] CORE-18320 ./gradlew cementApi --- .../scans/corda-application-5.2.0.yaml | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/application/scans/corda-application-5.2.0.yaml b/application/scans/corda-application-5.2.0.yaml index 8c86ca41b3..28f677c51f 100644 --- a/application/scans/corda-application-5.2.0.yaml +++ b/application/scans/corda-application-5.2.0.yaml @@ -1328,9 +1328,10 @@ net.corda.v5.application.messaging.FlowMessaging: annotation: - NotNull type: net.corda.v5.base.types.MemberX500Name - requireClose: - annotation: [] - type: boolean + sessionConfiguration: + annotation: + - NotNull + type: net.corda.v5.application.messaging.FlowSessionConfiguration flowContextPropertiesBuilder: annotation: - NotNull @@ -1460,6 +1461,53 @@ net.corda.v5.application.messaging.FlowSession: annotation: - NotNull type: Object +net.corda.v5.application.messaging.FlowSessionConfiguration: + annotations: [] + type: public class + extends: null + implements: [] + interface: false + methods: + getTimeout: + annotations: [] + default: false + type: public + returnType: java.time.Duration + isRequireClose: + annotations: [] + default: false + type: public + returnType: boolean +net.corda.v5.application.messaging.FlowSessionConfiguration$Builder: + annotations: [] + type: public static class + extends: null + implements: [] + interface: false + methods: + build: + annotations: [] + default: false + type: public + returnType: net.corda.v5.application.messaging.FlowSessionConfiguration + requireClose: + annotations: [] + default: false + type: public + returnType: net.corda.v5.application.messaging.FlowSessionConfiguration$Builder + params: + requireClose: + annotation: [] + type: boolean + timeout: + annotations: [] + default: false + type: public + returnType: net.corda.v5.application.messaging.FlowSessionConfiguration$Builder + params: + timeout: + annotation: [] + type: java.time.Duration net.corda.v5.application.persistence.CordaPersistenceException: annotations: [] type: public final class From 2dd4186b5de34e6f5272fb880b45ba3fec6af27c Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Tue, 19 Dec 2023 08:03:49 +0000 Subject: [PATCH 12/15] CORE-18320 Removed deprecations (this change will be in a separate PR) --- .../corda/v5/application/messaging/FlowMessaging.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java index dd3b8bb506..8dd2ceedbb 100644 --- a/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowMessaging.java @@ -95,9 +95,6 @@ public interface FlowMessaging { * 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 - * Use {@link FlowMessaging#initiateFlow(MemberX500Name, FlowSessionConfiguration)} instead. - * * @param x500Name The X500 name of the member to communicate with. * @param 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(). @@ -105,7 +102,6 @@ public interface FlowMessaging { * * @return The session. */ - @Deprecated(since = "5.2") @Suspendable @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose); @@ -194,10 +190,6 @@ public interface FlowMessaging { * }); * ``` * - * @deprecated - * Use {@link FlowMessaging#initiateFlow(MemberX500Name, FlowSessionConfiguration, FlowContextPropertiesBuilder)} - * instead. - * * @param x500Name The X500 name of the member to communicate with. * @param 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(). @@ -212,7 +204,6 @@ public interface FlowMessaging { * exception thrown by the builder will also be thrown through here and should be avoided in the provided * implementation, see {@link FlowContextPropertiesBuilder}. */ - @Deprecated(since = "5.2") @Suspendable @NotNull FlowSession initiateFlow(@NotNull MemberX500Name x500Name, boolean requireClose, @NotNull FlowContextPropertiesBuilder flowContextPropertiesBuilder); From 061c57cb6f54ce382c16ef37ade0e20490d81ba3 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Tue, 19 Dec 2023 11:17:32 +0000 Subject: [PATCH 13/15] CORE-18320 Class FlowSessionConfiguration and related Builder made final --- .../v5/application/messaging/FlowSessionConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java b/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java index bbc8be4da4..8c832ec410 100644 --- a/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java +++ b/application/src/main/java/net/corda/v5/application/messaging/FlowSessionConfiguration.java @@ -5,7 +5,7 @@ /** * Flow session configuration. Instances should be created using {@link Builder}. */ -public class FlowSessionConfiguration { +public final class FlowSessionConfiguration { private final boolean requireClose; private final Duration timeout; @@ -22,7 +22,7 @@ public Duration getTimeout() { return timeout; } - public static class Builder { + public static final class Builder { private boolean requireClose = true; private Duration timeout; From 52b6a1b5bc5c5212683b91c4be964ea8959398df Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Wed, 20 Dec 2023 09:08:39 +0000 Subject: [PATCH 14/15] CORE-18320 Increased API version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5cde18bd12..53bbd4f054 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 18 +cordaApiRevision = 19 # Main kotlin.stdlib.default.dependency = false From 5f5034cb3de40a75347e285ed9bf545bce16eb90 Mon Sep 17 00:00:00 2001 From: Miljenko Brkic Date: Wed, 20 Dec 2023 09:56:43 +0000 Subject: [PATCH 15/15] CORE-18320 Increased API version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ecc8d115d6..95e765185c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ cordaProductVersion = 5.2.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 19 +cordaApiRevision = 20 # Main kotlin.stdlib.default.dependency = false