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

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

The newest version!
//
// Copyright 2017 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;

import net.sf.eBus.messages.ENotificationMessage;

/**
 * Provides a common view for {@link EPublishFeed} and
 * {@link EMultiPublishFeed} feeds. Allows an application to
 * reference single- and multi-subject publish feeds referenced
 * as an {@code IEPublishFeed}.
 *
 * @author Charles W. Rapp
 */

public interface IEPublishFeed
    extends IEFeed
{
//---------------------------------------------------------------
// Member methods.
//

    /**
     * Returns {@code true} if this publish feed is both
     * open and advertised; otherwise, returns {@code false}.
     * @return {@code true} if this publish feed is open and
     * advertised.
     */
    boolean isAdvertised();

    /**
     * Returns the current publish state.
     * @return current publish state.
     */
    EFeedState publishState();

    /**
     * Returns {@code true} if the publisher is clear to publish
     * a notification for the given feed and {@code false} if not
     * clear.
     * @param subject check the feed status for this subject.
     * @return {@code true} if the specified publisher feed is up
     * and the publisher is free to publish notification
     * messages for the specified subject.
     */
    boolean isFeedUp(String subject);

    /**
     * Advertises this publisher feed to the associated
     * notification subject. If this feed is currently advertised
     * to the subject, then does nothing.
     */
    void advertise();

    /**
     * Retracts this publisher feed from the associated
     * notification subject. Does nothing if this feed is not
     * currently advertised.
     */
    void unadvertise();

    /**
     * Updates the publish feed state to the given value. If
     * {@code update} equals the currently stored publish feed
     * state, nothing is done. Otherwise, the updated value is
     * stored. If this feed is advertised to the server and
     * the subscription feed is up, then this update is forwarded
     * to the subject.
     * @param update new publish feed state.
     */
    void updateFeedState(EFeedState update);

    /**
     * Posts this notification message to all interested
     * subscribers.
     * @param msg post this message to subscribers.
     */
    void publish(ENotificationMessage msg);
} // end of interface IEPublishFeed





© 2015 - 2024 Weber Informatics LLC | Privacy Policy