first commit
This commit is contained in:
23
internal/pubsub/subscriber.go
Normal file
23
internal/pubsub/subscriber.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package pubsub
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"database/sql"
|
||||
|
||||
"github.com/ThreeDotsLabs/watermill"
|
||||
sqlwatermill "github.com/ThreeDotsLabs/watermill-sql/pkg/sql"
|
||||
"github.com/ThreeDotsLabs/watermill/message"
|
||||
)
|
||||
|
||||
func NewSubscriber(db *sql.DB, logger watermill.LoggerAdapter) (message.Subscriber, error) {
|
||||
return sqlwatermill.NewSubscriber(
|
||||
db,
|
||||
sqlwatermill.SubscriberConfig{
|
||||
SchemaAdapter: sqlwatermill.DefaultPostgreSQLSchema{},
|
||||
OffsetsAdapter: sqlwatermill.DefaultPostgreSQLOffsetsAdapter{},
|
||||
PollInterval: 3 * time.Second,
|
||||
},
|
||||
logger,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user