Interface MessageFacility


  • public interface MessageFacility

    Rhino extension facility which allows a resource adaptor entity to send messages between Rhino nodes in the same cluster or pool.

    The MessageFacility is made available to a resource adaptor entity via its configuration properties, under the CONFIG_PROPERTY_NAME key.

    An example of how to access the message facility from a resource adaptor is given below:

    import com.opencloud.rhino.facilities.message.MessageFacility;
    import javax.slee.resource.ConfigProperties;
    
    public class MyResourceAdapter implements ResourceAdaptor {
    
        public void raConfigure(ConfigProperties configProperties) {
          ...
          MessageFacility messageFacility = null;
          ConfigProperties.Property property = configProperties.getProperty(MessageFacility.CONFIG_PROPERTY_NAME);
          if (property != null) {
              messageFacility = (MessageFacility) property.getValue();
          }
          ...
        }
        ...
    }
    • Field Detail

      • CONFIG_PROPERTY_NAME

        static final String CONFIG_PROPERTY_NAME

        Config property key string defining the location where an instance of the MessageFacility interface may be found by a resource adaptor entity in the ConfigProperties given to it.

        See Also:
        Constant Field Values
    • Method Detail

      • getLocalNodeID

        int getLocalNodeID()

        Get the node ID of the current Rhino node.

        This method returns the node ID in the legacy numeric form. For new work, it is recommended to use getRhinoNodeID() instead.

        Returns:
        the local node ID.
      • getRhinoNodeID

        String getRhinoNodeID()

        Get the node ID of the current Rhino node. This method returns the node ID in string form.

        Returns:
        the local node ID.
        Since:
        Rhino 3.2
      • removeMessageListener

        void removeMessageListener​(MessageListener listener)

        Remove a message listener. If the listener was not currently registered, this method has no effect.

        This method would typically be called in raUnconfigure(), raStopping(), or raInactive().

        Parameters:
        listener - the message listener to remove.
      • setRequestListener

        void setRequestListener​(RequestListener listener)

        Set a listener to respond to incoming requests.

        Typically this method would be called in raConfigure(ConfigProperties).

        At most one request listener (regardless of type) may be set in the message facility at any one time. Calling this method will replace any existing request listener with the new listener specified.

        For new work, it is recommended to use setRequestListener(RequestListenerV2) instead of this method, where RequestListenerV2 uses string node IDs instead of numeric.

        Parameters:
        listener - the request listener. May be null to clear any existing listener reference.
        Since:
        Rhino 2.3.0
      • addMessageListener

        void addMessageListener​(MessageListenerV2 listener)

        Add a message listener. If the listener has already been added, this method has no effect.

        Typically this method would be called in raConfigure(ConfigProperties) or raActive().

        Parameters:
        listener - the message listener to add.
        Since:
        Rhino 3.2
      • removeMessageListener

        void removeMessageListener​(MessageListenerV2 listener)

        Remove a message listener. If the listener was not currently registered, this method has no effect.

        This method would typically be called in raUnconfigure(), raStopping(), or raInactive().

        Parameters:
        listener - the message listener to remove.
        Since:
        Rhino 3.2
      • setRequestListener

        void setRequestListener​(RequestListenerV2 listener)

        Set a listener to respond to incoming requests.

        Typically this method would be called in raConfigure(ConfigProperties).

        At most one request listener (regardless of type) may be set in the message facility at any one time. Calling this method will replace any existing request listener with the new listener specified.

        Parameters:
        listener - the request listener. May be null to clear any existing listener reference.
        Since:
        Rhino 3.2