Package io.servicetalk.concurrent.api
Class TestPublisher.Builder<T>
- java.lang.Object
-
- io.servicetalk.concurrent.api.TestPublisher.Builder<T>
-
- Type Parameters:
T- Type of the items emitted by theTestPublisher.
- Enclosing class:
- TestPublisher<T>
public static class TestPublisher.Builder<T> extends java.lang.ObjectAllows for creatingTestPublishers with non-default settings. For defaults, see Defaults section of class javadoc.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
-
-
-
Method Detail
-
concurrentSubscribers
public TestPublisher.Builder<T> concurrentSubscribers()
Allow concurrent subscribers. Default is to allow only sequential subscribers.- Returns:
- this.
- See Also:
ConcurrentPublisherSubscriberFunction
-
concurrentSubscribers
public TestPublisher.Builder<T> concurrentSubscribers(ConcurrentPublisherSubscriberFunction<T> function)
Allow concurrent subscribers, with the specifiedConcurrentPublisherSubscriberFunction. Default is to allow only sequential subscribers.- Parameters:
function- theConcurrentPublisherSubscriberFunctionto use.- Returns:
- this.
-
sequentialSubscribers
public TestPublisher.Builder<T> sequentialSubscribers()
Allow sequential subscribers. This is the default.- Returns:
- this.
- See Also:
SequentialPublisherSubscriberFunction
-
sequentialSubscribers
public TestPublisher.Builder<T> sequentialSubscribers(SequentialPublisherSubscriberFunction<T> function)
Allow sequential subscribers, with the specifiedSequentialPublisherSubscriberFunction. This is the default.- Parameters:
function- theSequentialPublisherSubscriberFunctionto use.- Returns:
- this.
-
singleSubscriber
public TestPublisher.Builder<T> singleSubscriber()
Allow only a single subscriber. Default is to allow sequential subscribers.- Returns:
- this.
- See Also:
NonResubscribeablePublisherSubscriberFunction
-
singleSubscriber
public TestPublisher.Builder<T> singleSubscriber(NonResubscribeablePublisherSubscriberFunction<T> function)
Allow only a single subscriber, with the specifiedNonResubscribeablePublisherSubscriberFunction. Default is to allow sequential subscribers.- Parameters:
function- theNonResubscribeablePublisherSubscriberFunctionto use.- Returns:
- this.
-
enableDemandCheck
public TestPublisher.Builder<T> enableDemandCheck()
Enables asserting items are not delivered without sufficient demand. The default is enabled.- Returns:
- this.
- See Also:
DemandCheckingSubscriber
-
enableDemandCheck
public TestPublisher.Builder<T> enableDemandCheck(DemandCheckingSubscriberFunction<T> function)
Enables asserting items are not delivered without sufficient demand, with the specifiedDemandCheckingSubscriberFunction. The default is enabled.- Parameters:
function- theDemandCheckingSubscriberFunctionto use.- Returns:
- this.
-
disableDemandCheck
public TestPublisher.Builder<T> disableDemandCheck()
Disables asserting items are not delivered without sufficient demand. The default is enabled.- Returns:
- this.
-
autoOnSubscribe
public TestPublisher.Builder<T> autoOnSubscribe()
Enable callingPublisherSource.Subscriber.onSubscribe(Subscription)automatically upon subscribe. The default is enabled.- Returns:
- this.
- See Also:
AutoOnSubscribePublisherSubscriberFunction
-
autoOnSubscribe
public TestPublisher.Builder<T> autoOnSubscribe(AutoOnSubscribePublisherSubscriberFunction<T> function)
Enable callingPublisherSource.Subscriber.onSubscribe(Subscription)automatically upon subscribe, with the specifiedAutoOnSubscribePublisherSubscriberFunction. The default is enabled.- Parameters:
function- theAutoOnSubscribePublisherSubscriberFunctionto use.- Returns:
- this.
-
disableAutoOnSubscribe
public TestPublisher.Builder<T> disableAutoOnSubscribe()
Disable callingPublisherSource.Subscriber.onSubscribe(Subscription)automatically upon subscribe. The default is enabled.- Returns:
- this.
-
build
public TestPublisher<T> build(java.util.function.Function<PublisherSource.Subscriber<? super T>,PublisherSource.Subscriber<? super T>> function)
Create aTestPublisherusing the specified subscriber function.All other settings from this
TestPublisher.Builderwill be ignored.- Parameters:
function- The subscriber function to use.- Returns:
- a new
TestPublisher.
-
build
public TestPublisher<T> build()
Create aTestPublisheras configured by the builder.- Returns:
- a new
TestPublisher.
-
-