initial commit
This commit is contained in:
27
internal/pkg/azure/azbus/azbus.go
Normal file
27
internal/pkg/azure/azbus/azbus.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package azbus
|
||||
|
||||
import (
|
||||
"github.com/ThreeDotsLabs/watermill"
|
||||
"github.com/ThreeDotsLabs/watermill/message"
|
||||
"github.com/ThreeDotsLabs/watermill/pubsub/gochannel"
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
"base/config"
|
||||
"base/pkg/watermill/azsb"
|
||||
)
|
||||
|
||||
func New(cfg *config.AppConfig, logger zerolog.Logger) (message.Subscriber, message.Publisher, error) {
|
||||
if cfg.Environment == config.Local {
|
||||
gch := gochannel.NewGoChannel(gochannel.Config{}, watermill.NewStdLogger(true, true))
|
||||
return gch, gch, nil
|
||||
}
|
||||
|
||||
return azsb.NewAzBus(
|
||||
azsb.Config{
|
||||
ConnectionString: cfg.AzureServiceBus.ConnectionString,
|
||||
UseManagedIdentity: cfg.AzureServiceBus.UseManagedIdentity,
|
||||
Namespace: cfg.AzureServiceBus.Namespace,
|
||||
},
|
||||
logger,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user