Package com.turtlequeue
Class ConsumerImpl<T>
- java.lang.Object
-
- com.turtlequeue.ConsumerImpl<T>
-
- All Implemented Interfaces:
Consumer<T>,Closeable,AutoCloseable
public class ConsumerImpl<T> extends Object implements Consumer<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected LongackTimeoutCountprotected TimeUnitackTimeoutUnitprotected ConsumerParamsconfprotected LongconsumerIdprotected StringconsumerNameprotected EndOfTopicMessageListener<T>endOfTopicMessageListenerprotected BooleanhasReachedEndOfTopicprotected MessageIdinitialPositionprotected MessageIdlastDequeuedMessageIdprotected IntegermaxReceiverQueueSizeprotected ConcurrentLinkedQueue<CompletableFuture<Message<T>>>pendingReceivesprotected Integerpriorityprotected IntegerreceiverQueueRefillThresholdprotected StringsubNameprotected Topictopic
-
Method Summary
-
-
-
Field Detail
-
consumerId
protected Long consumerId
-
topic
protected Topic topic
-
subName
protected String subName
-
consumerName
protected String consumerName
-
priority
protected Integer priority
-
initialPosition
protected MessageId initialPosition
-
endOfTopicMessageListener
protected EndOfTopicMessageListener<T> endOfTopicMessageListener
-
ackTimeoutCount
protected Long ackTimeoutCount
-
ackTimeoutUnit
protected TimeUnit ackTimeoutUnit
-
conf
protected ConsumerParams conf
-
receiverQueueRefillThreshold
protected Integer receiverQueueRefillThreshold
-
maxReceiverQueueSize
protected Integer maxReceiverQueueSize
-
hasReachedEndOfTopic
protected Boolean hasReachedEndOfTopic
-
pendingReceives
protected final ConcurrentLinkedQueue<CompletableFuture<Message<T>>> pendingReceives
-
lastDequeuedMessageId
protected volatile MessageId lastDequeuedMessageId
-
-
Method Detail
-
disconnect
protected void disconnect()
-
reconnect
protected void reconnect()
-
setTopicTerminated
protected void setTopicTerminated()
-
hasReachedEndOfTopic
public Boolean hasReachedEndOfTopic()
- Specified by:
hasReachedEndOfTopicin interfaceConsumer<T>
-
hasMessageAvailable
public CompletableFuture<Boolean> hasMessageAvailable()
-
seek
public CompletableFuture<Void> seek(MessageId messageId)
-
isConnected
public boolean isConnected()
- Specified by:
isConnectedin interfaceConsumer<T>
-
seek
public CompletableFuture<Void> seek(long timestamp)
-
getTopic
public Topic getTopic()
-
getConf
protected ConsumerParams getConf()
-
getConsumerId
protected Long getConsumerId()
-
clearReceiverQueue
protected void clearReceiverQueue()
-
enqueue
protected void enqueue(com.turtlequeue.sdk.api.proto.Tq.CommandMessage msg)
-
subscribeReturn
protected CompletableFuture<ConsumerImpl<T>> subscribeReturn()
-
increaseAvailablePermits
protected void increaseAvailablePermits(int delta)
-
receive
public CompletableFuture<Message<T>> receive()
-
newAcknowledge
public AcknowledgeBuilder newAcknowledge()
-
acknowledge
public CompletableFuture<Void> acknowledge(MessageId messageId)
-
acknowledge
public CompletableFuture<Void> acknowledge(Message<T> message)
- Specified by:
acknowledgein interfaceConsumer<T>
-
nonAcknowledge
public CompletableFuture<Void> nonAcknowledge(MessageId messageId)
- Specified by:
nonAcknowledgein interfaceConsumer<T>
-
nonAcknowledge
public CompletableFuture<Void> nonAcknowledge(Message<T> message)
- Specified by:
nonAcknowledgein interfaceConsumer<T>
-
redeliverUnacknowledgedMessages
public CompletableFuture<Void> redeliverUnacknowledgedMessages()
- Specified by:
redeliverUnacknowledgedMessagesin interfaceConsumer<T>
-
acknowledgeCumulativeAsync
public CompletableFuture<Void> acknowledgeCumulativeAsync(Message<T> message)
- Specified by:
acknowledgeCumulativeAsyncin interfaceConsumer<T>
-
closeAsync
protected CompletableFuture<Void> closeAsync(boolean informBroker)
-
close
public void close()
-
-