Interface ObjectType.MessageStream

Enclosing interface:
ObjectType

public static interface ObjectType.MessageStream
A stream of messages, either sent from the server to the client, or client to the server. ObjectType plugin implementations provide an instance of this interface for each incoming stream to invoke as messages arrive, and will likewise be given an instance of this interface to be able to send messages to the client.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Simple stream that does no handling on data or close.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the stream on both ends.
    void
    onData(ByteBuffer payload, Object... references)
    Transmits/receives data to/from the remote end of the stream.
  • Field Details

  • Method Details

    • onData

      void onData(ByteBuffer payload, Object... references) throws ObjectCommunicationException
      Transmits/receives data to/from the remote end of the stream. This can consist of a binary payload and references to objects on the server.

      When implementing this interface for a plugin, this method will be invoked when a request arrives from the client. When invoking this method from in a plugin, it will send a response to the client.

      Note that sending a message can cause an exception if there is an error in serializing, and for that reason this method throws a checked exception. It is safe to let that propagate up through either an incoming onData call from a client, or the call to create the stream, but it is usually unsafe to let this propagate to other engine threads.
      Parameters:
      payload - the binary data sent to the remote implementation
      references - server-side object references sent to the remote implementation
      Throws:
      ObjectCommunicationException - a checked exception for any errors that may occur, to ensure that the error is handled without propagating.
    • onClose

      void onClose()
      Closes the stream on both ends. No further messages can be sent or received.