feat: implement Validate to check for cycle

This commit is contained in:
sujit
2024-10-23 14:11:39 +05:45
parent 9ca4e1c2f4
commit 1ec5630d3e
6 changed files with 112 additions and 57 deletions

View File

@@ -232,7 +232,14 @@ func (c *Consumer) Consume(ctx context.Context) error {
if err != nil {
return err
}
c.pool = NewPool(c.opts.numOfWorkers, c.opts.queueSize, c.opts.maxMemoryLoad, c.ProcessTask, c.OnResponse, c.opts.storage)
c.pool = NewPool(
c.opts.numOfWorkers,
WithTaskQueueSize(c.opts.queueSize),
WithMaxMemoryLoad(c.opts.maxMemoryLoad),
WithHandler(c.ProcessTask),
WithPoolCallback(c.OnResponse),
WithTaskStorage(c.opts.storage),
)
if err := c.subscribe(ctx, c.queue); err != nil {
return fmt.Errorf("failed to connect to server for queue %s: %v", c.queue, err)
}