Interface JsonChannel


public interface JsonChannel

Represents a JSON channel to a subject on the Liberator.

A Channel provides a bi-directional communication channel between a StreamLink application and a DataSource adapter. Using a Channel in both DataSource and StreamLink provides a simplified method of communication between the two components and can allow you just to use the Caplin platform as a bi-directional messaging pipe.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the channel to the Liberator.
    Returns the subject name to which the channel relates.
    void
    send(Object obj, CommandListener commandListener)
    Sends object as JSON to the channel subject
  • Method Details

    • getSubject

      String getSubject()
      Returns the subject name to which the channel relates.
      Returns:
      The subject of this channel.
    • closeChannel

      void closeChannel()
      Closes the channel to the Liberator. This will result in a corresponding call to onChannelClose declared in ChannelListener on the DataSource. The delay before onChannelClose is called is defined by the Liberator configuration item, active-discard-timeout.
    • send

      void send(Object obj, CommandListener commandListener)
      Sends object as JSON to the channel subject
      Parameters:
      obj - the object to send in JSON format (using the installed JsonHandler to serialize the object to JSON)
      commandListener - optional callback for command completion (can set to null).