Documentation ¶
Index ¶
Constants ¶
const ( // CreateUser should be used for create requests CreateUser = "createUser" // DeleteUser should be used for delete requests DeleteUser = "deleteUser" // UpdateUser should be used for update requests UpdateUser = "updateUser" // ListUser should be used for list requests ListUser = "listUser" // ListUserAnswer should be used for list callbacks ListUserAnswer = "listUserAnswer" // Notification should be used for notifications Notification = "notification" )
const ( // ProcessorQueue name ProcessorQueue = "processorQueue" // CallbackQueue name CallbackQueue = "callbackQueue" // NotificationQueue name NotificationQueue = "notificationQueue" )
Variables ¶
This section is empty.
Functions ¶
func OpenConnection ¶
func OpenConnection(url string) (*amqp.Connection, error)
OpenConnection opens a rabbitmq connection
Types ¶
type Message ¶
Message holds all data needed by manager and processor to read and send rabbitmq messages
type MessageQueueRead ¶
type MessageQueueRead interface { GetMessageFromQueue() (*Message, error) GetMessageFromQueueWithCID(cID string) (*Message, error) }
MessageQueueRead contains all method needed by consumers
type MessageQueueWrite ¶
MessageQueueWrite contains all method needed by producers
type MockMessagingSystem ¶
type MockMessagingSystem struct { Received []Message MessageToReturn []Message ErrorToReturn []error // contains filtered or unexported fields }
MockMessagingSystem is just a mock
func (*MockMessagingSystem) GetMessageFromQueue ¶
func (mm *MockMessagingSystem) GetMessageFromQueue() (*Message, error)
GetMessageFromQueue here to implement interface
func (*MockMessagingSystem) GetMessageFromQueueWithCID ¶
func (mm *MockMessagingSystem) GetMessageFromQueueWithCID(_ string) (*Message, error)
GetMessageFromQueueWithCID here to implement interface
func (*MockMessagingSystem) PostMessageToQueue ¶
func (mm *MockMessagingSystem) PostMessageToQueue(message Message) error
PostMessageToQueue here to implement interface
type RabbitMQ ¶
type RabbitMQ struct {
// contains filtered or unexported fields
}
RabbitMQ stub implementation of a messaging system, if needed we could have different structs for producers and consumers having different interfaces was considered enough for a stub
func NewRabbitMQ ¶
func NewRabbitMQ(conn *amqp.Connection, queueName string) (*RabbitMQ, error)
NewRabbitMQ setup new RabbitMQ opening connections and creating the queue if needed
func (RabbitMQ) GetMessageFromQueue ¶
GetMessageFromQueue get one message from the queue it could have been implemented returning a channel
func (RabbitMQ) GetMessageFromQueueWithCID ¶
GetMessageFromQueueWithCID get a message from the queue with a specific CID requeueing if needed
func (RabbitMQ) PostMessageToQueue ¶
PostMessageToQueue post a message to a queue