Пример #1
0
// receiver receives messages and pushes to a queue.
func (c *connection) receiver(receiver electron.Receiver) {
	q := c.broker.queues.Get(receiver.Target())
	for {
		if rm, err := receiver.Receive(); err == nil {
			util.Debugf("%v: received %v", receiver, util.FormatMessage(rm.Message))
			q <- rm.Message
			rm.Accept()
		} else {
			util.Debugf("%v error: %v", receiver, err)
			break
		}
	}
}
Пример #2
0
// receiver receives messages and pushes to a queue.
func (b *broker) receiver(receiver electron.Receiver) {
	q := b.queues.Get(receiver.Target())
	for {
		if rm, err := receiver.Receive(); err == nil {
			util.Debugf("%s: received %s", receiver, util.FormatMessage(rm.Message))
			q <- rm.Message
			rm.Accept()
		} else {
			util.Debugf("%s error: %s", receiver, err)
			break
		}
	}
}