Interface MessageSender


  • public interface MessageSender

    Interface used by the resource adaptor to pass messages to peer nodes, within the context of the resource adaptor entity.

    Accessed via the MessageFacility.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void sendBroadcast​(byte[] payload)
      Sends the given message asynchronously to the same resource adaptor entity on all nodes in the cluster, including the sending node.
      void sendMessage​(int destinationNode, byte[] payload)
      Sends the given message asynchronously to the same resource adaptor entity on the given destination node.
      RemoteResult<?>[] sendRequest​(byte[] payload, boolean synchronous)
      Sends the given request to the same resource adaptor entity on all nodes in the cluster, including the sending node.
      RemoteResult<?> sendRequest​(int destinationNode, byte[] payload, boolean synchronous)
      Sends the given request to the same resource adaptor entity on the given destination node.
    • Method Detail

      • sendMessage

        void sendMessage​(int destinationNode,
                         byte[] payload)
                  throws IOException

        Sends the given message asynchronously to the same resource adaptor entity on the given destination node.

        Parameters:
        destinationNode - the destination node.
        payload - the message.
        Throws:
        IOException - if an error occurs trying to send the request.
      • sendBroadcast

        void sendBroadcast​(byte[] payload)
                    throws IOException

        Sends the given message asynchronously to the same resource adaptor entity on all nodes in the cluster, including the sending node.

        Parameters:
        payload - the message.
        Throws:
        IOException - if an error occurs trying to send the request.
      • sendRequest

        RemoteResult<?> sendRequest​(int destinationNode,
                                    byte[] payload,
                                    boolean synchronous)
                             throws IOException

        Sends the given request to the same resource adaptor entity on the given destination node.

        Parameters:
        destinationNode - the destination node.
        payload - the request message.
        synchronous - flag indicating whether the request should be sent synchronously (true) or asynchronously (false). A synchronous request will only return control to the calling thread once a result has been received from the destination node.
        Returns:
        the result.
        Throws:
        IOException - if an error occurs trying to send the request.
      • sendRequest

        RemoteResult<?>[] sendRequest​(byte[] payload,
                                      boolean synchronous)
                               throws IOException

        Sends the given request to the same resource adaptor entity on all nodes in the cluster, including the sending node.

        Parameters:
        payload - the request message.
        synchronous - flag indicating whether the request should be sent synchronously (true) or asynchronously (false). A synchronous request will only return control to the calling thread when results have been received from all nodes.
        Returns:
        an array of result objects, one for each node.
        Throws:
        IOException - if an error occurs trying to send the request.