26 lines
		
	
	
		
			521 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			521 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package tasks
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	"github.com/drhin/logger"
 | |
| 	"github.com/hibiken/asynq"
 | |
| )
 | |
| 
 | |
| type TaskDistributor interface {
 | |
| 	DistributeTaskConsumeAuditLog(ctx context.Context, payload *PayloadConsumeAuditLog, opts ...asynq.Option) error
 | |
| }
 | |
| 
 | |
| type RedisTaskDistributor struct {
 | |
| 	log    *logger.Logger
 | |
| 	client *asynq.Client
 | |
| }
 | |
| 
 | |
| func NewRedisTaskDistributor(log *logger.Logger, opt *RedisClientConnector) TaskDistributor {
 | |
| 	client := asynq.NewClient(opt)
 | |
| 	return &RedisTaskDistributor{
 | |
| 		log:    log,
 | |
| 		client: client,
 | |
| 	}
 | |
| }
 |