Documentation ¶
Index ¶
- Constants
- Variables
- type Sender
- func (s *Sender) ConnectionStatus() nats.Status
- func (s *Sender) LivenessCheck(w http.ResponseWriter, _ *http.Request)
- func (s *Sender) ReadinessCheck(w http.ResponseWriter, _ *http.Request)
- func (s *Sender) Send(_ context.Context, event *event.Event) sender.PublishError
- func (s *Sender) URL() string
Constants ¶
View Source
const (
JSStoreFailedCode = 10077
)
Variables ¶
View Source
var ( ErrNotConnected = common.BackendPublishError{HTTPCode: http.StatusBadGateway, Info: "no connection to NATS JetStream server"} ErrCannotSendToStream = common.BackendPublishError{HTTPCode: http.StatusGatewayTimeout, Info: "cannot send to stream"} ErrNoSpaceLeftOnDevice = common.BackendPublishError{HTTPCode: http.StatusInsufficientStorage, Info: "insufficient resources on target stream"} )
Functions ¶
This section is empty.
Types ¶
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender is responsible for sending messages over HTTP.
func NewSender ¶
func NewSender(ctx context.Context, connection *nats.Conn, envCfg *env.NATSConfig, opts *options.Options, logger *logger.Logger) *Sender
NewSender returns a new NewSender instance with the given NATS connection.
func (*Sender) ConnectionStatus ¶
func (s *Sender) ConnectionStatus() nats.Status
ConnectionStatus returns nats.code for the NATS connection used by the Sender.
func (*Sender) LivenessCheck ¶
func (s *Sender) LivenessCheck(w http.ResponseWriter, _ *http.Request)
func (*Sender) ReadinessCheck ¶
func (s *Sender) ReadinessCheck(w http.ResponseWriter, _ *http.Request)
ReadinessCheck returns an instance of http.HandlerFunc that checks the readiness of the given NATS Handler. It checks the NATS server connection status and reports 2XX if connected, otherwise reports 5XX. It panics if the given NATS Handler is nil.
Click to show internal directories.
Click to hide internal directories.