Package org.zalando.fahrschein
Class SimplePartitionManager
java.lang.Object
org.zalando.fahrschein.SimplePartitionManager
- All Implemented Interfaces:
PartitionManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanacquireLock(String eventName, String lockedBy) lockPartitions(String eventName, List<Partition> partitions, String lockedBy) Locks partitions for one event.protected abstract voidreleaseLock(String eventName, String lockedBy) voidunlockPartitions(Lock lock) Unlocks previously locked partitions.
-
Constructor Details
-
SimplePartitionManager
public SimplePartitionManager()
-
-
Method Details
-
acquireLock
-
releaseLock
-
lockPartitions
Description copied from interface:PartitionManagerLocks partitions for one event. When running consumers on multiple nodes they should try to lock partitions so that events are only processed by one consumer.- Specified by:
lockPartitionsin interfacePartitionManager- Parameters:
eventName- Name of the eventpartitions- The partitions to locklockedBy- Name of one node of the consuming application- Returns:
- A
Lockinstance containing the list of locked partitions if locking succeeded,Optional.empty()otherwise
-
unlockPartitions
Description copied from interface:PartitionManagerUnlocks previously locked partitions.- Specified by:
unlockPartitionsin interfacePartitionManager- Parameters:
lock- The lock object returned fromPartitionManager.lockPartitions(String, List, String)
-