messaging

package
v0.0.0-...-cbf1151 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 7 Imported by: 2

Documentation

Index

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) 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) 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.

type MockMessagingClient

type MockMessagingClient struct {
	mock.Mock
}

MockMessagingClient is an autogenerated mock type for the IMessagingClient type

func (*MockMessagingClient) Close

func (_m *MockMessagingClient) Close()

Close provides a mock function with given fields:

func (*MockMessagingClient) ConnectToBroker

func (_m *MockMessagingClient) ConnectToBroker(connectionString string)

ConnectToBroker provides a mock function with given fields: connectionString

func (*MockMessagingClient) Publish

func (_m *MockMessagingClient) Publish(msg []byte, exchangeName string, exchangeType string) error

Publish provides a mock function with given fields: msg, exchangeName, exchangeType

func (*MockMessagingClient) PublishOnQueue

func (_m *MockMessagingClient) PublishOnQueue(msg []byte, queueName string) error

PublishOnQueue provides a mock function with given fields: msg, queueName

func (*MockMessagingClient) PublishOnQueueWithContext

func (_m *MockMessagingClient) PublishOnQueueWithContext(ctx context.Context, msg []byte, queueName string) error

PublishOnQueueWithContext provides a mock function with given fields: ctx, msg, queueName

func (*MockMessagingClient) Subscribe

func (_m *MockMessagingClient) Subscribe(exchangeName string, exchangeType string, consumerName string, handlerFunc func(amqp.Delivery)) error

Subscribe provides a mock function with given fields: exchangeName, exchangeType, consumerName, handlerFunc

func (*MockMessagingClient) SubscribeToQueue

func (_m *MockMessagingClient) SubscribeToQueue(queueName string, consumerName string, handlerFunc func(amqp.Delivery)) error

SubscribeToQueue provides a mock function with given fields: queueName, consumerName, handlerFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL