Lease-based Consumer Coordination
Consumers use a lease mechanism to claim exclusive ownership of partitions:
type LeaseInfo struct { Owned bool Revision uint64 Value leaseValue } type leaseValue struct { WorkerID string `json:"worker_id"` ExpiresAt time.Time `json:"expires_at"` }
Each consumer:
- Attempts to claim partitions through the lease store
- Regularly renews leases to maintain ownership
- Releases leases during graceful shutdown
- Automatically expires leases when consumers fail
Category: NATS