Interface ClientStartableFlow

  • All Implemented Interfaces:
    net.corda.v5.application.flows.Flow

    
    public interface ClientStartableFlow
     implements Flow
                        

    ClientStartableFlow is a Flow that is started via RPC.

    call takes in a ClientRequestBody, containing the body of the RPC request that started the flow.

    The string return type is treated by the platform as a JSON encoded string to return to the REST service, and will appear in the REST flow status when the flow completes. To assist in returning valid JSON, the JsonMarshallingService can be used.

    Flows implementing this interface must have a no-arg constructor. The flow invocation will fail if this constructor does not exist.

    Example usage:

    • Kotlin:
      
      class MyFlow : ClientStartableFlow {
      
          
          lateinit var jsonMarshallingService: JsonMarshallingService
      
          
          override fun call(requestBody: RestRequestBody): String {
              val parameters = requestBody.getRequestBodyAs<MyFlowParameters>(jsonMarshallingService)
              ...
              return jsonMarshallingService.format(parameters)
          }
      }
      
    • Java:
      
      public class MyFlow implements ClientStartableFlow {
      
          
          public JsonMarshallingService jsonMarshallingService;
      
          
          
          public String call(RestRequestBody requestBody) {
              MyFlowParameters parameters = requestBody.getRequestBodyAs(jsonMarshallingService, MyFlowParameters.class);
              ...
              return jsonMarshallingService.format(parameters);
          }
      }
      
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract String call(@NotNull() ClientRequestBody requestBody) The business logic for this flow should be written here.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • call

        @Suspendable()@NotNull() abstract String call(@NotNull() ClientRequestBody requestBody)

        The business logic for this flow should be written here.

        This is equivalent to the normal flow call method, where the output is fixed to being a JSON encoded string. Additionally, the call method is invoked with the body of the RPC request.

        Parameters:
        requestBody - The body of the RPC request that started this flow.