public class Subscription extends Object implements ConsumableChannel
| Modifier and Type | Field and Description |
|---|---|
protected ActorConditions |
actorConditions |
protected ActorCondition |
dataConsumed |
protected Metric |
fragmentsConsumedMetric |
protected int |
id |
protected boolean |
isClosed |
protected AtomicPosition |
limit |
static org.slf4j.Logger |
LOG |
protected LogBuffer |
logBuffer |
protected String |
name |
protected AtomicPosition |
position |
protected ByteBuffer |
rawDispatcherBufferView |
| Constructor and Description |
|---|
Subscription(AtomicPosition position,
AtomicPosition limit,
int id,
String name,
ActorCondition onConsumption,
LogBuffer logBuffer,
Metric fragmentsConsumedMetric) |
| Modifier and Type | Method and Description |
|---|---|
protected ActorConditions |
getActorConditions() |
int |
getId() |
protected long |
getLimit() |
String |
getName() |
long |
getPosition() |
boolean |
hasAvailable() |
int |
peekAndConsume(FragmentHandler frgHandler,
int maxNumOfFragments)
Sequentially read fragments from the buffer and invoke the given handler for each fragment.
|
int |
peekBlock(BlockPeek availableBlock,
int maxBlockSize,
boolean isStreamAware)
Read fragments from the buffer as block.
|
protected int |
peekBlock(LogBufferPartition partition,
BlockPeek availableBlock,
int partitionId,
int partitionOffset,
int maxBlockSize,
long limit,
boolean isStreamAware) |
int |
poll(FragmentHandler frgHandler,
int maxNumOfFragments)
Read fragments from the buffer and invoke the given handler for each fragment.
|
protected int |
pollFragments(LogBufferPartition partition,
FragmentHandler frgHandler,
int partitionId,
int fragmentOffset,
int maxNumOfFragments,
long limit,
boolean handlerControlled) |
void |
registerConsumer(ActorCondition consumer) |
void |
removeConsumer(ActorCondition consumer) |
String |
toString() |
public static final org.slf4j.Logger LOG
protected final ActorConditions actorConditions
protected final AtomicPosition limit
protected final AtomicPosition position
protected final LogBuffer logBuffer
protected final int id
protected final String name
protected final ActorCondition dataConsumed
protected final ByteBuffer rawDispatcherBufferView
protected final Metric fragmentsConsumedMetric
protected volatile boolean isClosed
public Subscription(AtomicPosition position, AtomicPosition limit, int id, String name, ActorCondition onConsumption, LogBuffer logBuffer, Metric fragmentsConsumedMetric)
public long getPosition()
public boolean hasAvailable()
hasAvailable in interface ConsumableChannelprotected long getLimit()
public int poll(FragmentHandler frgHandler, int maxNumOfFragments)
Note that the handler is not aware of fragment batches.
protected int pollFragments(LogBufferPartition partition, FragmentHandler frgHandler, int partitionId, int fragmentOffset, int maxNumOfFragments, long limit, boolean handlerControlled)
public int peekAndConsume(FragmentHandler frgHandler, int maxNumOfFragments)
FragmentHandler.onFragment(org.agrona.DirectBuffer, int, int, int, boolean). If a
fragment is not consumed then no following fragments are read.
Note that the handler is not aware of fragment batches.
public int peekBlock(BlockPeek availableBlock, int maxBlockSize, boolean isStreamAware)
BlockPeek.getBuffer() to consume the
fragments and finish the operation using BlockPeek.markCompleted() or BlockPeek.markFailed().
Note that the block only contains complete fragment batches.
isStreamAware - if true, it stops reading fragments when a fragment has a
different stream id than the previous oneprotected int peekBlock(LogBufferPartition partition, BlockPeek availableBlock, int partitionId, int partitionOffset, int maxBlockSize, long limit, boolean isStreamAware)
public void registerConsumer(ActorCondition consumer)
registerConsumer in interface ConsumableChannelpublic void removeConsumer(ActorCondition consumer)
removeConsumer in interface ConsumableChannelpublic int getId()
public String getName()
protected ActorConditions getActorConditions()
Copyright © 2017–2018 camunda services GmbH. All rights reserved.