Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueueLock ¶
type QueueLock interface { // LockOrPush tries to lock lockID and pushes item to queue by lockID if fails. // Return true if locks or false if error or item is added to queue. LockOrPush(ctx context.Context, lockID string, item []byte) (bool, error) // PopOrUnlock tries to extend lock lockID and pops item from queue by lockID. // It unlocks lockID if either fails. PopOrUnlock(ctx context.Context, lockID string, asyncUnlock bool) ([]byte, error) // LockAndPop tries to lock lockID and pops item from queue by lockID. LockAndPop(ctx context.Context, lockID string, asyncUnlock bool) ([]byte, error) }
QueueLock interface is used to implement a lock to consistently process items for the same resource. Base implementation uses redis to set lock and store next items while current item is processing. Im-memory mutex is used to synchronize access to redis so it cannot be used in multi-instance app.
type Scheduler ¶
type Scheduler interface { Start(ctx context.Context) Stop(ctx context.Context) ProcessEvent(context.Context, types.Event) error AckEvent(context.Context, types.Event) error }
Scheduler ...
func NewSchedulerService ¶
func NewSchedulerService( redisLockStorage redismod.UniversalClient, redisQueueStorage redismod.UniversalClient, channelPub libamqp.Channel, publishToQueue string, logger zerolog.Logger, lockTtl int, decoder encoding.Decoder, encoder encoding.Encoder, ) Scheduler
NewSchedulerService ...
Click to show internal directories.
Click to hide internal directories.