Skip to content

Commit 16a880a

Browse files
committed
redefining Config type in distributed package
1 parent 6153f5f commit 16a880a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

distributed.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ import (
66
"github.com/monetha/go-distributed/broker/mutexbroker"
77
)
88

9+
// Config is a broker configuration
10+
type Config consulbroker.Config
11+
912
// NewBroker creates a Broker which allows you to execute arbitrary tasks in a distributed infrastructure.
1013
// The same tasks should be registered on a multiple servers, but only one instance of the task will be launched.
1114
// Consul key is used to uniquely identify the task.
1215
// When `cfg` is not nil Broker uses Consul to acquire the distributed lock and to ensure a single instance of
1316
// a task is running.
1417
// In case `cfg` is nil Broker uses mutex and runs all tasks locally allowing you not to have Consul cluster
1518
// and simulate distributed environment.
16-
func NewBroker(cfg *consulbroker.Config) (broker.Broker, error) {
19+
func NewBroker(cfg *Config) (broker.Broker, error) {
1720
if cfg == nil {
1821
return mutexbroker.New(), nil
1922
}
20-
return consulbroker.New(cfg)
23+
return consulbroker.New((*consulbroker.Config)(cfg))
2124
}

0 commit comments

Comments
 (0)