Package org.zalando.fahrschein
Interface PartitionManager
-
- All Known Implementing Classes:
SimplePartitionManager
public interface PartitionManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<Lock>lockPartitions(String eventName, List<Partition> partitions, String lockedBy)Locks partitions for one event.voidunlockPartitions(Lock lock)Unlocks previously locked partitions.
-
-
-
Method Detail
-
lockPartitions
Optional<Lock> lockPartitions(String eventName, List<Partition> partitions, String lockedBy)
Locks 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.- 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
void unlockPartitions(Lock lock)
Unlocks previously locked partitions.- Parameters:
lock- The lock object returned fromlockPartitions(String, List, String)
-
-