All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.eBus.client.RequestCallback Maven / Gradle / Ivy

The newest version!
//
// Copyright 2016 Charles W. Rapp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package net.sf.eBus.client;

/**
 * This functional interface may be used to handle request
 * delivery instead of
 * {@link EReplier#request(EReplyFeed.ERequest)}
 * by passing a {@code RequestCallback} instance to
 * {@link EReplyFeed.Builder#requestCallback(RequestCallback)}
 * This allows a tighter coupling between a feed and the code for
 * processing the feed's requests.
 *
 * @see EReplyFeed.Builder#requestCallback(RequestCallback)
 *
 * @author Charles W. Rapp
 */

@FunctionalInterface
public interface RequestCallback
{
//---------------------------------------------------------------
// Member methods.
//

    /**
     * An incoming request. The replier may send a
     * {@link EReplyFeed.ERequest#reply(net.sf.eBus.messages.EReplyMessage) reply}
     * either from within this method call or asynchronously
     * after returning from this method. If the reply is sent
     * asynchronously, then the replier must store
     * {@code request} for later use. Replies are sent using
     * {@code ERequest} and not {@code EReplyFeed}.
     * 

* The * {@link net.sf.eBus.messages.ERequestMessage request message} * is stored in {@code request} and can be retrieved by * calling {@link EReplyFeed.ERequest#request()}. *

*

* The {@link EReplyFeed.ERequest request} matches the * replier's open and advertised {@link EReplyFeed feed}. The * associated {@code EReplyFeed} may be retrieved by calling * {@link EReplyFeed.ERequest#replier()}. *

* @param request post replies to {@code msg} to this * request. */ void call(EReplyFeed.ERequest request); } // end of interface RequestCallback




© 2015 - 2024 Weber Informatics LLC | Privacy Policy