generated from kyma-project/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rely on the NATS cluster connection status when reporting the Eventin…
…g CR status
- Loading branch information
1 parent
e7a0190
commit 601af6a
Showing
10 changed files
with
564 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package connection | ||
|
||
type Interface interface { | ||
// Connect connects and returns an error if it failed. | ||
Connect() error | ||
|
||
// IsConnected returns true if it is connected, otherwise returns false. | ||
IsConnected() bool | ||
|
||
// Disconnect disconnects the active connection. | ||
Disconnect() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package errors | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
const ( | ||
errCannotConnect = "cannot connect to NATS" | ||
) | ||
|
||
var ErrCannotConnect = errors.New(errCannotConnect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package nats | ||
|
||
import ( | ||
natsio "github.com/nats-io/nats.go" | ||
|
||
"github.com/kyma-project/eventing-manager/internal/connection" | ||
) | ||
|
||
//go:generate go run github.com/vektra/mockery/v2 --name Interface | ||
type Interface interface { | ||
connection.Interface | ||
|
||
RegisterReconnectHandler(natsio.ConnHandler) | ||
IsReconnectHandlerRegistered() bool | ||
RegisterDisconnectErrHandler(natsio.ConnErrHandler) | ||
IsDisconnectErrHandlerRegistered() bool | ||
} |
Oops, something went wrong.