Documentation
¶
Index ¶
- func NewBasicMockMessageQueue() lanternmq.MessageQueue
- type BasicMockMessageQueue
- type MessageQueue
- func (mq *MessageQueue) Close()
- func (mq *MessageQueue) Connect(username string, password string, host string, port string) error
- func (mq *MessageQueue) ConsumeFromQueue(chID lanternmq.ChannelID, qName string) (lanternmq.Messages, error)
- func (mq *MessageQueue) CreateChannel() (lanternmq.ChannelID, error)
- func (mq *MessageQueue) DeclareExchange(chID lanternmq.ChannelID, name string, exchangeType string) error
- func (mq *MessageQueue) DeclareExchangeReceiveQueue(chID lanternmq.ChannelID, topicName string, qName string, routingKey string) error
- func (mq *MessageQueue) DeclareQueue(chID lanternmq.ChannelID, name string) error
- func (mq *MessageQueue) NumConcurrentMsgs(chID lanternmq.ChannelID, num int) error
- func (mq *MessageQueue) ProcessMessages(ctx context.Context, msgs lanternmq.Messages, handler lanternmq.MessageHandler, ...)
- func (mq *MessageQueue) PublishToExchange(chID lanternmq.ChannelID, name string, routingKey string, message string) error
- func (mq *MessageQueue) PublishToQueue(chID lanternmq.ChannelID, qName string, message string) error
- func (mq *MessageQueue) QueueExists(chID lanternmq.ChannelID, qName string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBasicMockMessageQueue ¶
func NewBasicMockMessageQueue() lanternmq.MessageQueue
NewBasicMockMessageQueue initializes a BasicMockMessageQueue. Currently does not initialize any topic related functions.
Types ¶
type BasicMockMessageQueue ¶
type BasicMockMessageQueue struct { Queue chan []byte MessageQueue }
BasicMockMessageQueue is a basic implementation of a queue for byte arrays. It only sends and receives on a single queue and ignores things like channel and queue name. It can only handle 20 messages on the queue at a time.
type MessageQueue ¶
type MessageQueue struct { ConnectFn func(username string, password string, host string, port string) error CreateChannelFn func() (lanternmq.ChannelID, error) NumConcurrentMsgsFn func(chID lanternmq.ChannelID, num int) error QueueExistsFn func(chID lanternmq.ChannelID, qName string) (bool, error) DeclareQueueFn func(chID lanternmq.ChannelID, name string) error PublishToQueueFn func(chID lanternmq.ChannelID, qName string, message string) error ConsumeFromQueueFn func(chID lanternmq.ChannelID, qName string) (lanternmq.Messages, error) ProcessMessagesFn func(ctx context.Context, msgs lanternmq.Messages, handler lanternmq.MessageHandler, args *map[string]interface{}, errs chan<- error) DeclareExchangeFn func(chID lanternmq.ChannelID, name string, exchangeType string) error PublishToExchangeFn func(chID lanternmq.ChannelID, name string, routingKey string, message string) error DeclareExchangeReceiveQueueFn func(chID lanternmq.ChannelID, topicName string, qName string, routingKey string) error CloseFn func() }
MessageQueue implements the lanternmq.MessageQueue interface and allows mock implementations of a MessageQueue. Each MessageQueue method calls the corresponding method <methodName>Fn as assigned in the mock MessageQueue structure. It also assigns <methodName>Invoked to true when <methodName> is called.
func (*MessageQueue) Close ¶
func (mq *MessageQueue) Close()
Close mocks lanternmq.Close and calls mq.CloseFn with the given arguments.
func (*MessageQueue) Connect ¶
Connect mocks lanternmq.Connect and calls mq.ConnectFn with the given arguments.
func (*MessageQueue) ConsumeFromQueue ¶
func (mq *MessageQueue) ConsumeFromQueue(chID lanternmq.ChannelID, qName string) (lanternmq.Messages, error)
ConsumeFromQueue mocks lanternmq.ConsumeFromQueue and calls mq.ConsumeFromQueueFn with the given arguments.
func (*MessageQueue) CreateChannel ¶
func (mq *MessageQueue) CreateChannel() (lanternmq.ChannelID, error)
CreateChannel mocks lanternmq.CreateChannel and calls mq.CreateChannelFn with the given arguments.
func (*MessageQueue) DeclareExchange ¶
func (mq *MessageQueue) DeclareExchange(chID lanternmq.ChannelID, name string, exchangeType string) error
DeclareExchange mocks lanternmq.DeclareExchange and calls mq.DeclareExchangeFn with the given arguments.
func (*MessageQueue) DeclareExchangeReceiveQueue ¶
func (mq *MessageQueue) DeclareExchangeReceiveQueue(chID lanternmq.ChannelID, topicName string, qName string, routingKey string) error
DeclareExchangeReceiveQueue mocks lanternmq.DeclareExchangeReceiveQueue and calls mq.DeclareExchangeReceiveQueueFn with the given arguments.
func (*MessageQueue) DeclareQueue ¶
func (mq *MessageQueue) DeclareQueue(chID lanternmq.ChannelID, name string) error
DeclareQueue mocks lanternmq.DeclareQueue and calls mq.DeclareQueueFn with the given arguments.
func (*MessageQueue) NumConcurrentMsgs ¶
func (mq *MessageQueue) NumConcurrentMsgs(chID lanternmq.ChannelID, num int) error
NumConcurrentMsgs mocks lanternmq.NumConcurrentMsgs and calls mq.NumConcurrentMsgsFn with the given arguments.
func (*MessageQueue) ProcessMessages ¶
func (mq *MessageQueue) ProcessMessages(ctx context.Context, msgs lanternmq.Messages, handler lanternmq.MessageHandler, args *map[string]interface{}, errs chan<- error)
ProcessMessages mocks lanternmq.ProcessMessages and sets mq.ProcessMessagesInvoked to true and calls mq.ProcessMessagesFn with the given arguments.
func (*MessageQueue) PublishToExchange ¶
func (mq *MessageQueue) PublishToExchange(chID lanternmq.ChannelID, name string, routingKey string, message string) error
PublishToExchange mocks lanternmq.PublishToExchange and calls mq.PublishToExchangeFn with the given arguments.
func (*MessageQueue) PublishToQueue ¶
func (mq *MessageQueue) PublishToQueue(chID lanternmq.ChannelID, qName string, message string) error
PublishToQueue mocks lanternmq.PublishToQueue and calls mq.PublishToQueueFn with the given arguments.
func (*MessageQueue) QueueExists ¶
QueueExists mocks lanternmq.QueueExists and calls mq.QueueExistsFn with the given arguments.