Interface ERequestMonitor

  • All Superinterfaces:
    EObject

    public interface ERequestMonitor
    extends EObject
    Classes needing to monitor EReplier request processing must implement this interface. A request monitor must:
    1. build the request monitor feed,
    2. monitor for requests to and replies from local repliers,
    3. retract monitoring when no longer necessary, and
    4. close feed when no longer needed.

    ERequestMonitor supports three callbacks:

    1. request(ERequestMessage, String): request message delivered to named replier. Because eBus maintains only weak references to eBus objects, the replier's name is passed to the request monitor and not the EReplier instance itself. Therefore, the developer is encouraged to give repliers unique, meaningful names.
    2. reply(EReplyMessage, String): reply message sent from named replier.
    3. cancel(ERequestMessage, String): request message is now canceled on named replier.

    As mentioned previously, a request monitor can only monitor requests posted to and replies from local EReplier objects. Requests and replies with remote repliers cannot be locally monitored.

    Note: unlike the other four roles (publisher, subscriber, requester, and replier) the request monitor is not informed if requester and repliers for the configured request message key are in place or not. That is because the request monitor is not interacting with requesters and repliers; instead the monitor is standing to the side and watching the interaction between the two.

    Author:
    Charles W. Rapp
    See Also:
    ERequestMonitorFeed, EReplier, ERequestMessage
    • Method Detail

      • request

        default void request​(ERequestMessage request,
                             java.lang.String replier)
        An incoming request for given replier.
        Parameters:
        request - inbound request message.
        replier - request delivered to replier with this eBus object name.
        Throws:
        java.lang.UnsupportedOperationException - if this method is not overridden or replaced by a lambda expression.
      • reply

        default void reply​(EReplyMessage reply,
                           java.lang.String replier)
        An outgoing reply from given replier.
        Parameters:
        reply - outbound reply message.
        replier - reply send from replier with this eBus object name.
        Throws:
        java.lang.UnsupportedOperationException - if this method is not overridden or replaced by a lambda expression.
      • cancel

        default void cancel​(ERequestMessage message,
                            java.lang.String replier)
        An existing request is being automatically canceled.
        Parameters:
        message - canceled request.
        replier - eBus object name of replier handling this request
        Throws:
        java.lang.UnsupportedOperationException - if this method is not overridden or replaced by a lambda expression.