Class ReadableByteChannelPublisher

  • All Implemented Interfaces:

    public class ReadableByteChannelPublisher
    extends Object
    implements Flow.Publisher<DataChunk>
    Publish a channel content to a single subscriber. If channel doesn't offer data, then it is requested again after some period defined be retry schema.

    Only first subscriber is accepted.

    • Constructor Detail

      • ReadableByteChannelPublisher

        public ReadableByteChannelPublisher​(ReadableByteChannel channel,
                                            RetrySchema retrySchema)
        Creates new instance.
        channel - a channel to read and publish
        retrySchema - a retry schema functional interface used in case, that channel read retrieved zero bytes.
    • Method Detail

      • subscribe

        public void subscribe​(Flow.Subscriber<? super DataChunk> subscriberParam)
        Description copied from interface: Flow.Publisher
        Adds the given Subscriber if possible. If already subscribed, or the attempt to subscribe fails due to policy violations or errors, the Subscriber's onError method is invoked with an IllegalStateException. Otherwise, the Subscriber's onSubscribe method is invoked with a new Flow.Subscription. Subscribers may enable receiving items by invoking the request method of this Subscription, and may unsubscribe by invoking its cancel method.
        Specified by:
        subscribe in interface Flow.Publisher<DataChunk>
        subscriberParam - the subscriber