init push
This commit is contained in:
33
internal/service/file_processing_queue.go
Normal file
33
internal/service/file_processing_queue.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
filemanager "wucher/internal/domain/file_manager"
|
||||
"wucher/internal/queue"
|
||||
)
|
||||
|
||||
type fileProcessingQueueAdapter struct {
|
||||
producer queue.FileProcessingJobProducer
|
||||
}
|
||||
|
||||
func (a fileProcessingQueueAdapter) Enqueue(ctx context.Context, job filemanager.FileProcessingJob) error {
|
||||
return a.producer.Enqueue(ctx, queue.FileProcessingJob{
|
||||
JobID: job.JobID,
|
||||
FileUUID: job.FileUUID,
|
||||
Bucket: job.Bucket,
|
||||
ObjectKey: job.ObjectKey,
|
||||
UploadedBy: job.UploadedBy,
|
||||
MimeType: job.MimeType,
|
||||
SizeBytes: job.SizeBytes,
|
||||
TraceID: job.TraceID,
|
||||
RequestID: job.RequestID,
|
||||
})
|
||||
}
|
||||
|
||||
func AdaptFileProcessingQueue(producer queue.FileProcessingJobProducer) filemanager.FileProcessingQueue {
|
||||
if producer == nil {
|
||||
return nil
|
||||
}
|
||||
return fileProcessingQueueAdapter{producer: producer}
|
||||
}
|
||||
Reference in New Issue
Block a user