diff --git a/sensors/listener.go b/sensors/listener.go index 3ca71a6bd6..fcd329effe 100644 --- a/sensors/listener.go +++ b/sensors/listener.go @@ -33,6 +33,7 @@ import ( "github.com/argoproj/argo-events/common/logging" "github.com/argoproj/argo-events/eventbus" eventbusdriver "github.com/argoproj/argo-events/eventbus/driver" + "github.com/argoproj/argo-events/eventsources/sources" "github.com/argoproj/argo-events/pkg/apis/sensor/v1alpha1" sensordependencies "github.com/argoproj/argo-events/sensors/dependencies" sensortriggers "github.com/argoproj/argo-events/sensors/triggers" @@ -102,9 +103,14 @@ func (sensorCtx *SensorContext) ListenEvents(ctx context.Context, stopCh <-chan for _, t := range triggers { triggerNames = append(triggerNames, t.Template.Name) } - conn, err := ebDriver.Connect() + var conn eventbusdriver.Connection + err = sources.Connect(&common.DefaultRetry, func() error { + var err error + conn, err = ebDriver.Connect() + return err + }) if err != nil { - logger.Error("failed to connect to event bus", zap.Error(err)) + logger.Fatal("failed to connect to event bus", zap.Error(err)) return } defer conn.Close()