Package io.camunda.zeebe.dispatcher
Class Dispatcher
java.lang.Object
io.camunda.zeebe.util.sched.Actor
io.camunda.zeebe.dispatcher.Dispatcher
- All Implemented Interfaces:
CloseableSilently,AsyncClosable,ConcurrencyControl,AutoCloseable
Component for sending and receiving messages between different threads.
-
Field Summary
Fields inherited from class io.camunda.zeebe.util.sched.Actor
actor, ACTOR_PROP_NAME, ACTOR_PROP_PARTITION_ID -
Method Summary
Modifier and TypeMethodDescriptionlongclaimFragmentBatch(ClaimedFragmentBatch batch, int fragmentCount, int batchLength) Claim a batch of fragments on the buffer with the given length.longclaimSingleFragment(ClaimedFragment claim, int length) Claim a fragment of the buffer with the given length.longclaimSingleFragment(ClaimedFragment claim, int length, int streamId) Claim a fragment of the buffer with the given length and stream id.protected AtomicPositionprotected SubscriptiondoOpenSubscription(String subscriptionName, ActorCondition onConsumption) intgetName()longbooleanisClosed()protected SubscriptionnewSubscription(int subscriptionId, String subscriptionName, ActorCondition onConsumption) protected voidprotected voidopenSubscription(String subscriptionName) Creates a new subscription with the given name.openSubscriptionAsync(String subscriptionName) Creates a new subscription with the given name asynchronously.toString()intMethods inherited from class io.camunda.zeebe.util.sched.Actor
buildActorName, buildActorName, close, closeAsync, createContext, getContext, handleFailure, isActorClosed, onActorClosed, onActorCloseRequested, onActorFailed, onActorStarting, run, runOnCompletion, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.camunda.zeebe.util.sched.ConcurrencyControl
createCompletedFuture, createFuture
-
Method Details
-
getName
-
onActorStarted
protected void onActorStarted()- Overrides:
onActorStartedin classActor
-
onActorClosing
protected void onActorClosing()- Overrides:
onActorClosingin classActor
-
claimSingleFragment
Claim a fragment of the buffer with the given length. UseClaimedFragment.getBuffer()to write the message and finish the operation usingClaimedFragment.commit()orClaimedFragment.abort(). Note that the claim operation can fail if the publisher limit or the buffer partition size is reached.- Returns:
- the position for the fragment. Otherwise, the return value is negative.
-
claimSingleFragment
Claim a fragment of the buffer with the given length and stream id. UseClaimedFragment.getBuffer()to write the message and finish the operation usingClaimedFragment.commit()orClaimedFragment.abort(). Note that the claim operation can fail if the publisher limit or the buffer partition size is reached.- Returns:
- the position for the fragment. Otherwise, the return value is negative.
-
claimFragmentBatch
Claim a batch of fragments on the buffer with the given length. UseClaimedFragmentBatch.nextFragment(int, int)to add a new fragment to the batch. Write the fragment message usingClaimedFragmentBatch.getBuffer()andClaimedFragmentBatch.getFragmentOffset()to get the buffer offset of this fragment. Complete the whole batch operation by calling eitherClaimedFragmentBatch.commit()orClaimedFragmentBatch.abort(). Note that the claim operation can fail if the publisher limit or the buffer partition size is reached.- Returns:
- the position for the first fragment. Otherwise, the return value is negative.
-
updatePublisherLimit
public int updatePublisherLimit() -
openSubscription
Creates a new subscription with the given name.- Throws:
IllegalStateException-- if the dispatcher runs in pipeline-mode,
- if a subscription with this name already exists
-
openSubscriptionAsync
Creates a new subscription with the given name asynchronously. The operation fails if a subscription with this name already exists. -
doOpenSubscription
-
newSubscription
protected Subscription newSubscription(int subscriptionId, String subscriptionName, ActorCondition onConsumption) -
determineLimit
-
isClosed
public boolean isClosed() -
getLogBuffer
-
getMaxFragmentLength
public int getMaxFragmentLength() -
getPublisherPosition
public long getPublisherPosition() -
toString
-