Class BlockingPullSubscriberImpl
- java.lang.Object
-
- com.google.cloud.pubsublite.internal.BlockingPullSubscriberImpl
-
- All Implemented Interfaces:
BlockingPullSubscriber
,AutoCloseable
public class BlockingPullSubscriberImpl extends Object implements BlockingPullSubscriber
-
-
Constructor Summary
Constructors Constructor Description BlockingPullSubscriberImpl(SubscriberFactory factory, FlowControlSettings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Optional<SequencedMessage>
messageIfAvailable()
Pull messages if there is any ready to deliver.com.google.api.core.ApiFuture<Void>
onData()
Returns aApiFuture
that will be completed when there are messages available.
-
-
-
Constructor Detail
-
BlockingPullSubscriberImpl
public BlockingPullSubscriberImpl(SubscriberFactory factory, FlowControlSettings settings) throws CheckedApiException
- Throws:
CheckedApiException
-
-
Method Detail
-
onData
public com.google.api.core.ApiFuture<Void> onData()
Description copied from interface:BlockingPullSubscriber
Returns aApiFuture
that will be completed when there are messages available. Unfinished existingApiFuture
returned by onData() will be abandoned and superseded by new onData() call.CheckedApiException
will be set to the Future if there is underlying permanent error.- Specified by:
onData
in interfaceBlockingPullSubscriber
-
messageIfAvailable
public Optional<SequencedMessage> messageIfAvailable() throws CheckedApiException
Description copied from interface:BlockingPullSubscriber
Pull messages if there is any ready to deliver. Any message will only be delivered to one call if there are multiple concurrent calls.- Specified by:
messageIfAvailable
in interfaceBlockingPullSubscriber
- Throws:
CheckedApiException
- if there is underlying permanent error.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceBlockingPullSubscriber
-
-