File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,19 @@ import (
6
6
"github.com/monetha/go-distributed/broker/mutexbroker"
7
7
)
8
8
9
+ // Config is a broker configuration
10
+ type Config consulbroker.Config
11
+
9
12
// NewBroker creates a Broker which allows you to execute arbitrary tasks in a distributed infrastructure.
10
13
// The same tasks should be registered on a multiple servers, but only one instance of the task will be launched.
11
14
// Consul key is used to uniquely identify the task.
12
15
// When `cfg` is not nil Broker uses Consul to acquire the distributed lock and to ensure a single instance of
13
16
// a task is running.
14
17
// In case `cfg` is nil Broker uses mutex and runs all tasks locally allowing you not to have Consul cluster
15
18
// and simulate distributed environment.
16
- func NewBroker (cfg * consulbroker. Config ) (broker.Broker , error ) {
19
+ func NewBroker (cfg * Config ) (broker.Broker , error ) {
17
20
if cfg == nil {
18
21
return mutexbroker .New (), nil
19
22
}
20
- return consulbroker .New (cfg )
23
+ return consulbroker .New (( * consulbroker . Config )( cfg ) )
21
24
}
You can’t perform that action at this time.
0 commit comments