Interface ExternalMessaging

  • All Implemented Interfaces:

    
    public interface ExternalMessaging
    
                        

    ExternalMessaging allows a flow to communicate with an external system via a predefined named channel.

    The platform will provide an instance of ExternalMessaging to flows via property injection.

    A Flow can send use this API to send messages to any external channel that has been defined as part of the CorDapp ({@see Defining External Messaging Channels}).

    Example usage:

    • Kotlin:
      
      class MyFlow : ClientStartableFlow {
         
         lateinit var externalMessaging: ExternalMessaging
      
         override fun call(requestBody: RestRequestBody): String {
             val myChannelName = "my channel"
      
             // Send a simple message to my channel
             externalMessaging.send(myChannelName, "hello")
      
             // Send a simple message with an ID to my channel
             externalMessaging.send(myChannelName,"id-1", "hello")
      
             return ""
         }
       }
      
    • Java:
      
      class MyFlow implements ClientStartableFlow {
      
         
         public ExternalMessaging externalMessaging;
      
         
         public String call(RestRequestBody requestBody) {
             String myChannelName = "my channel";
      
             // Send a simple message to my channel
             externalMessaging.send(myChannelName, "hello");
      
             // Send a simple message with an ID to my channel
             externalMessaging.send(myChannelName,"id-1", "hello");
      
             return "";
         }
      }
      
    • 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 void send(@NotNull() String channelName, @NotNull() String message) Sends a message through a named channel.
      abstract void send(@NotNull() String channelName, @NotNull() String messageId, @NotNull() String message) Sends a message with identifier through a named channel.
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • send

        @Suspendable() abstract void send(@NotNull() String channelName, @NotNull() String message)

        Sends a message through a named channel.

        Parameters:
        channelName - The name of the channel the message should be sent through.
        message - The contents of the message to be sent.
      • send

        @Suspendable() abstract void send(@NotNull() String channelName, @NotNull() String messageId, @NotNull() String message)

        Sends a message with identifier through a named channel.

        Parameters:
        channelName - The name of the channel the message should be sent through.
        messageId - An ID of the message to be sent.
        message - The contents of the message to be sent.