Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
g41797 committed Oct 29, 2023
1 parent 159fb6c commit 0c1ea92
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,30 @@ There are 3 kinds of broker specific plugins:
- consumer (only for tests)

### Connector
- connects to the broker
- connects to the server(broker)
- periodically validate connection state and re-connect in case of failure
- informs another parts of the process about status of the connection
- provides additional information

Interface of connector:
```go
// Connector provides possibility for negotiation between sputnik based
// software and external broker process
type Connector interface {
// Connect to the broker or attach to existing shared
Connect(cf sputnik.ConfFactory, shared sputnik.ServerConnection) error

// For shared connection - detach, for own - close
type ServerConnector interface {
// Connects to the server and return connection to server
// If connection failed, returns error.
// ' Connect' for already connected
// and still not brocken connection should
// return the same value returned in previous
// successful call(s) and nil error
Connect(cf ConfFactory) (conn ServerConnection, err error)

// Returns false if
// - was not connected at all
// - was connected, but connection is brocken
// True returned if
// - connected and connection is alive
IsConnected() bool

// If connection is alive closes it
Disconnect()
}
```
Expand Down

0 comments on commit 0c1ea92

Please sign in to comment.