Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(opt ConnectionOptions)
Init initializes rabbitmq client. On success, it sets the DefaultClient to established client. On failure, it exits the application instance.
Types ¶
type Client ¶
type Client interface { // Start runs retry routine. // This does not block execution. // This should be called only once. Start() // Stop stops retry routine and consumers. // This also cleans up publishers and finally stops // the connection. // This should be called only once. After calling Stop // a client should not be used anymore, create a new client if // you have to. Stop() // Conn returns underlying rabbitmq.Conn Conn() *rabbitmq.Conn // AddConsumer adds and starts consuming AddConsumer(ConsumerOption) error // Publish publishes message, on failure enqueues for retry Publish(Message) }
Client interface for a rabbitmq pub/sub client
var DefaultClient Client
type ConnectionOptions ¶
type ConsumerOption ¶
type ConsumerOption struct { Exchange string RoutingKey string Queue string Consumer Consumer PrefetchCount int Dlq bool DlqRoutingKey string DlqName string }
ConsumerOption options to run a new consumer
type Logger ¶
type Logger struct{}
type Message ¶
Message structure to publish a new message
func NewMessage ¶
NewMessage creates a new Message instance. This is an utility function to create a new message instance.
Click to show internal directories.
Click to hide internal directories.