Documentation ¶
Index ¶
Constants ¶
const ( // DefaultDeliveryMode is used when writing messages to an exchange. DefaultDeliveryMode = amqp.Transient // DefaultRoutingKey is set to an empty string so all messages published to the exchange will // get routed to whatever queues are bound to it. DefaultRoutingKey = "" )
const (
// DefaultAPIPort is the default API port for RabbitMQ
DefaultAPIPort = 15672
)
const ( // DefaultURI is the default endpoint of RabbitMQ on the local machine. // Primarily used when initializing a new Client without a specific URI. DefaultURI = "amqp://guest:guest@localhost:5672/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the underlying connection to a RabbitMQ cluster.
func NewClient ¶
func NewClient(options ...ClientOptionFunc) (*Client, error)
NewClient creates a new client to work with RabbitMQ.
The caller can configure the new client by passing configuration options to the func.
Example:
client, err := NewClient( WithURI("mongodb://localhost:27017"))
If no URI is configured, it uses DefaultURI.
An error is also returned when a configuration option is invalid
type ClientOptionFunc ¶
ClientOptionFunc is a function that configures a Client. It is used in NewClient.
func WithCACerts ¶
func WithCACerts(certs []string) ClientOptionFunc
WithCACerts configures the RootCAs for the underlying TLS connection
func WithSSL ¶
func WithSSL(ssl bool) ClientOptionFunc
WithSSL configures the database connection to connect via TLS.
func WithURI ¶
func WithURI(uri string) ClientOptionFunc
WithURI defines the full connection string for the RabbitMQ connection
type RabbitMQ ¶
type RabbitMQ struct { adaptor.BaseConfig RoutingKey string `json:"routing_key"` KeyInField bool `json:"key_in_field"` DeliveryMode uint8 `json:"delivery_mode"` APIPort int `json:"api_port"` SSL bool `json:"ssl"` CACerts []string `json:"cacerts"` }
RabbitMQ defines all configurable elements for connecting to and sending/receiving JSON.
func (*RabbitMQ) Client ¶
Client creates an instance of Client to be used for connecting to RabbitMQ.
func (*RabbitMQ) Reader ¶
Reader instantiates a Reader for use with subscribing to one or more topics.
func (*RabbitMQ) SampleConfig ¶
SampleConfig for file adaptor
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements client.Reader by consuming messages from the cluster based on its configuration.
func (*Reader) Read ¶
func (r *Reader) Read(_ map[string]client.MessageSet, filterFn client.NsFilterFunc) client.MessageChanFunc