Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the Controller implementation for asyncapi-codegen.
func NewController ¶
func NewController(url string, options ...ControllerOption) (*Controller, error)
NewController creates a new NATS controller.
func (*Controller) Close ¶ added in v0.24.2
func (c *Controller) Close()
Close closes everything related to the broker.
func (*Controller) Publish ¶
func (c *Controller) Publish(_ context.Context, channel string, bm extensions.BrokerMessage) error
Publish a message to the broker.
func (*Controller) Subscribe ¶
func (c *Controller) Subscribe(ctx context.Context, channel string) (extensions.BrokerChannelSubscription, error)
Subscribe to messages from the broker.
type ControllerOption ¶
type ControllerOption func(controller *Controller) error
ControllerOption is a function that can be used to configure a NATS controller Examples: WithQueueGroup(), WithLogger().
func WithConnectionOpts ¶ added in v0.36.0
func WithConnectionOpts(opts ...nats.Option) ControllerOption
WithConnectionOpts set the nats.Options to connect to nats.
func WithLogger ¶
func WithLogger(logger extensions.Logger) ControllerOption
WithLogger set a custom logger that will log operations on broker controller.
func WithQueueGroup ¶
func WithQueueGroup(name string) ControllerOption
WithQueueGroup set a custom queue group for channel subscription.
type NoopAcknowledgementHandler ¶ added in v0.35.7
type NoopAcknowledgementHandler struct { }
NoopAcknowledgementHandler for nats broker, core NATS do not support ack/nak messages.
func (NoopAcknowledgementHandler) AckMessage ¶ added in v0.35.7
func (k NoopAcknowledgementHandler) AckMessage()
AckMessage acknowledges the message.
func (NoopAcknowledgementHandler) NakMessage ¶ added in v0.35.7
func (k NoopAcknowledgementHandler) NakMessage()
NakMessage negatively acknowledges the message.