3
0
Files
corteza/pkg/messagebus/store.go
2021-04-26 08:54:03 +02:00

34 lines
534 B
Go

package messagebus
import (
"context"
"time"
)
type (
StoreConsumer struct {
queue string
handle ConsumerType
client StoreClient
poll *time.Ticker
}
)
func NewStoreConsumer(settings QueueSettings) *StoreConsumer {
h := &StoreConsumer{
queue: settings.Queue,
handle: ConsumerStore,
client: &sClient{},
}
return h
}
func (cq *StoreConsumer) Write(ctx context.Context, p []byte) error {
return cq.client.Add(ctx, cq.queue, p)
}
func (cq *StoreConsumer) SetStore(s QueueStorer) {
cq.client.SetStorer(s)
}