Class FlowablePublish<T>

  • Type Parameters:
    T - the element type
    All Implemented Interfaces:
    HasUpstreamPublisher<T>, org.reactivestreams.Publisher<T>

    public final class FlowablePublish<T>
    extends ConnectableFlowable<T>
    implements HasUpstreamPublisher<T>
    Shares a single underlying connection to the upstream Publisher and multicasts events to all subscribed subscribers until the upstream completes or the connection is disposed.

    The difference to FlowablePublish is that when the upstream terminates, late subscribers will receive that terminal event until the connection is disposed and the ConnectableFlowable is reset to its fresh state.

    Since:
    2.2.10
    • Field Detail

      • source

        final org.reactivestreams.Publisher<T> source
      • bufferSize

        final int bufferSize
    • Constructor Detail

      • FlowablePublish

        public FlowablePublish​(org.reactivestreams.Publisher<T> source,
                               int bufferSize)
    • Method Detail

      • source

        public org.reactivestreams.Publisher<T> source()
        Description copied from interface: HasUpstreamPublisher
        Returns the source Publisher.

        This method is intended to discover the assembly graph of sequences.

        Specified by:
        source in interface HasUpstreamPublisher<T>
        Returns:
        the source Publisher
      • connect

        public void connect​(Consumer<? super Disposable> connection)
        Description copied from class: ConnectableFlowable
        Instructs the ConnectableFlowable to begin emitting the items from its underlying Flowable to its Subscribers.
        Scheduler:
        The behavior is determined by the implementor of this abstract class.
        Specified by:
        connect in class ConnectableFlowable<T>
        Parameters:
        connection - the action that receives the connection subscription before the subscription to source happens allowing the caller to synchronously disconnect a synchronous source
        See Also:
        ReactiveX documentation: Connect
      • subscribeActual

        protected void subscribeActual​(org.reactivestreams.Subscriber<? super T> s)
        Description copied from class: Flowable
        Operator implementations (both source and intermediate) should implement this method that performs the necessary business logic and handles the incoming Subscribers.

        There is no need to call any of the plugin hooks on the current Flowable instance or the Subscriber; all hooks and basic safeguards have been applied by Flowable.subscribe(Subscriber) before this method gets called.

        Specified by:
        subscribeActual in class Flowable<T>
        Parameters:
        s - the incoming Subscriber, never null
      • reset

        public void reset()
        Description copied from class: ConnectableFlowable
        Resets this ConnectableFlowable into its fresh state if it has terminated.

        Calling this method on a fresh or active ConnectableFlowable has no effect.

        Scheduler:
        The behavior is determined by the implementor of this abstract class.
        Specified by:
        reset in class ConnectableFlowable<T>