Skip to content

Commit

Permalink
fix: Add call to Message Bus Connect()
Browse files Browse the repository at this point in the history
Core data was missing call to connect to message bus and needed latest go-mod-messging for MQTT Message Bus to work.

closes #2466

Signed-off-by: lenny <leonard.goodell@intel.com>
  • Loading branch information
lenny committed Apr 3, 2020
1 parent 5d710f1 commit ae5bb09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/edgexfoundry/go-mod-bootstrap v0.0.26
github.com/edgexfoundry/go-mod-configuration v0.0.3
github.com/edgexfoundry/go-mod-core-contracts v0.1.52
github.com/edgexfoundry/go-mod-messaging v0.1.14
github.com/edgexfoundry/go-mod-messaging v0.1.16
github.com/edgexfoundry/go-mod-registry v0.1.17
github.com/edgexfoundry/go-mod-secrets v0.0.17
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
Expand Down
16 changes: 15 additions & 1 deletion internal/core/data/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _

configuration := dataContainer.ConfigurationFrom(dic.Get)
registryClient := container.RegistryFrom(dic.Get)
lc := container.LoggingClientFrom(dic.Get)

mdc := metadata.NewDeviceClient(
urlclient.New(
Expand Down Expand Up @@ -90,12 +91,25 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _
Optional: configuration.MessageQueue.Optional,
})

lc := container.LoggingClientFrom(dic.Get)
if err != nil {
lc.Error(fmt.Sprintf("failed to create messaging client: %s", err.Error()))
return false
}

err = msgClient.Connect()
if err != nil {
lc.Error(fmt.Sprintf("failed to connect to message bus: %s", err.Error()))
return false
}

lc.Info(fmt.Sprintf(
"Connected to %s Message Bus @ %s://%s:%d publishing on '%s' topic",
configuration.MessageQueue.Type,
configuration.MessageQueue.Protocol,
configuration.MessageQueue.Host,
configuration.MessageQueue.Port,
configuration.MessageQueue.Topic))

chEvents := make(chan interface{}, 100)
// initialize event handlers
initEventHandlers(lc, chEvents, mdc, msc, configuration)
Expand Down

0 comments on commit ae5bb09

Please sign in to comment.