Documentation ¶
Overview ¶
Package snorlax provides tools for message query based microservices:
- Configuration through environment;
- Logging through standard log;
- Use only one transport = amqp through RabbitMQ;
- Use only one exchange type for all = topic;
No registry, service discovery and other smart things. Let k8s do the rest.
Index ¶
- Variables
- func PublisherExchange(exchange string) func(*pubOpts)
- func PublisherNotDurable() func(*pubOpts)
- func PublisherQueue(queue string) func(*pubOpts)
- func PublisherWrapper(w PubWrapper) func(*pubOpts)
- func SubscriberAutoAck() func(*subOpts)
- func SubscriberExchange(exchange string) func(*subOpts)
- func SubscriberNotDurable() func(*subOpts)
- func SubscriberQueue(queue string) func(*subOpts)
- func SubscriberWrapper(w SubWrapper) func(*subOpts)
- func TLS(t *tls.Config) func(*opts)
- func URL(url string) func(*opts)
- type Handler
- type Option
- type PubFn
- type PubWrapper
- type Publisher
- type PublisherOption
- type Snorlax
- type SubFn
- type SubStatus
- type SubWrapper
- type Subscriber
- type SubscriberOption
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func PublisherExchange ¶
func PublisherExchange(exchange string) func(*pubOpts)
PublisherExchange. Defaults to "amq.topic".
func PublisherNotDurable ¶
func PublisherNotDurable() func(*pubOpts)
func PublisherQueue ¶
func PublisherQueue(queue string) func(*pubOpts)
func PublisherWrapper ¶
func PublisherWrapper(w PubWrapper) func(*pubOpts)
func SubscriberAutoAck ¶
func SubscriberAutoAck() func(*subOpts)
func SubscriberExchange ¶
func SubscriberExchange(exchange string) func(*subOpts)
SubscriberExchange. Defaults to "amq.topic".
func SubscriberNotDurable ¶
func SubscriberNotDurable() func(*subOpts)
func SubscriberQueue ¶
func SubscriberQueue(queue string) func(*subOpts)
func SubscriberWrapper ¶
func SubscriberWrapper(w SubWrapper) func(*subOpts)
Types ¶
type Handler ¶
Handler handles messages from subscriber. Msg always proto.Message and will be parsed to specific one based on "MessageType" header.
type Option ¶
type Option func(*opts)
func DeclareExchange ¶
DeclareExchange on Snorlax initialization. Always topic and always durable.
type PubWrapper ¶
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher publish proto messages.
type PublisherOption ¶
type PublisherOption func(*pubOpts)
type Snorlax ¶
type Snorlax struct {
// contains filtered or unexported fields
}
Snorlax is main point for creating pubs and subs.
func (*Snorlax) NewPublisher ¶
func (s *Snorlax) NewPublisher(optsf ...PublisherOption) (*Publisher, error)
NewPublisher creates channel to RabbitMQ.
func (*Snorlax) NewSubscriber ¶
func (s *Snorlax) NewSubscriber(optsf ...SubscriberOption) (*Subscriber, error)
NewSubscriber creates channel to RabbitMQ
type SubStatus ¶
type SubStatus struct { Exchange string Queue string Topic string MessageType string ContentType string Error error }
SubStatus from Subscriber. Useful for metrics and logging.
type SubWrapper ¶
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber subscribes to exchange's topic.
type SubscriberOption ¶
type SubscriberOption func(*subOpts)
func SubscribeThrottlingInterval ¶ added in v0.2.0
func SubscribeThrottlingInterval(duration string) SubscriberOption