001package org.reactivestreams;
002
003/**
004 * A {@link Publisher} is a provider of a potentially unbounded number of sequenced elements, publishing them according to
005 * the demand received from its {@link Subscriber}(s).
006 * <p>
007 * A {@link Publisher} can serve multiple {@link Subscriber}s subscribed {@link #subscribe(Subscriber)} dynamically
008 * at various points in time.
009 *
010 * @param <T> the type of element signaled.
011 */
012public interface Publisher<T> {
013
014    /**
015     * Request {@link Publisher} to start streaming data.
016     * <p>
017     * This is a "factory method" and can be called multiple times, each time starting a new {@link Subscription}.
018     * <p>
019     * Each {@link Subscription} will work for only a single {@link Subscriber}.
020     * <p>
021     * A {@link Subscriber} should only subscribe once to a single {@link Publisher}.
022     * <p>
023     * If the {@link Publisher} rejects the subscription attempt or otherwise fails it will
024     * signal the error via {@link Subscriber#onError}.
025     *
026     * @param s the {@link Subscriber} that will consume signals from this {@link Publisher}
027     */
028    public void subscribe(Subscriber<? super T> s);
029}