Documentation
¶
Index ¶
- type AmqpClient
- func (m *AmqpClient) Close()
- func (m *AmqpClient) ConnectToBroker(connectionString string)
- func (m *AmqpClient) Publish(body []byte, exchangeName string, exchangeType string) (err error)
- func (m *AmqpClient) PublishOnQueue(body []byte, queueName string) error
- func (m *AmqpClient) PublishOnQueueWithContext(ctx context.Context, body []byte, queueName string) (err error)
- func (m *AmqpClient) Subscribe(exchangeName string, exchangeType string, consumerName string, ...) error
- func (m *AmqpClient) SubscribeToQueue(queueName string, consumerName string, handlerFunc func(amqp.Delivery)) error
- type IMessagingClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmqpClient ¶
type AmqpClient struct {
// contains filtered or unexported fields
}
AmqpClient is our real implementation, encapsulates a pointer to an amqp.Connection
func (*AmqpClient) Close ¶
func (m *AmqpClient) Close()
Close closes the connection to the AMQP-broker, if available.
func (*AmqpClient) ConnectToBroker ¶
func (m *AmqpClient) ConnectToBroker(connectionString string)
ConnectToBroker connects to an AMQP broker using the supplied connectionString.
func (*AmqpClient) Publish ¶
func (m *AmqpClient) Publish(body []byte, exchangeName string, exchangeType string) (err error)
Publish publishes a message to the named exchange.
func (*AmqpClient) PublishOnQueue ¶
func (m *AmqpClient) PublishOnQueue(body []byte, queueName string) error
PublishOnQueue publishes the supplied body on the queueName.
func (*AmqpClient) PublishOnQueueWithContext ¶
func (m *AmqpClient) PublishOnQueueWithContext(ctx context.Context, body []byte, queueName string) (err error)
PublishOnQueueWithContext publishes the supplied body onto the named queue, passing the context.
func (*AmqpClient) Subscribe ¶
func (m *AmqpClient) Subscribe(exchangeName string, exchangeType string, consumerName string, handlerFunc func(amqp.Delivery)) error
Subscribe registers a handler function for a given exchange.
func (*AmqpClient) SubscribeToQueue ¶
func (m *AmqpClient) SubscribeToQueue(queueName string, consumerName string, handlerFunc func(amqp.Delivery)) error
SubscribeToQueue registers a handler function for the named queue.
type IMessagingClient ¶
type IMessagingClient interface { ConnectToBroker(connectionString string) Publish(msg []byte, exchangeName string, exchangeType string) error PublishOnQueue(msg []byte, queueName string) error PublishOnQueueWithContext(ctx context.Context, msg []byte, queueName string) error Subscribe(exchangeName string, exchangeType string, consumerName string, handlerFunc func(amqp.Delivery)) error SubscribeToQueue(queueName string, consumerName string, handlerFunc func(amqp.Delivery)) error Close() }
IMessagingClient defines our interface for connecting and consuming messages.