MCPcopy Create free account
hub / github.com/assembla/cony / serve

Method serve

consumer.go:65–95  ·  view source on GitHub ↗
(client mqDeleter, ch mqChannel)

Source from the content-addressed store, hash-verified

63}
64
65func (c *Consumer) serve(client mqDeleter, ch mqChannel) {
66 if c.reportErr(ch.Qos(c.qos, 0, false)) {
67 return
68 }
69
70 deliveries, err2 := ch.Consume(c.q.Name,
71 c.tag, // consumer tag
72 c.autoAck, // autoAck,
73 c.exclusive, // exclusive,
74 c.noLocal, // noLocal,
75 false, // noWait,
76 nil, // args Table
77 )
78 if c.reportErr(err2) {
79 return
80 }
81
82 for {
83 select {
84 case <-c.stop:
85 client.deleteConsumer(c)
86 ch.Close()
87 return
88 case d, ok := <-deliveries: // deliveries will be closed once channel is closed (disconnected from network)
89 if !ok {
90 return
91 }
92 c.deliveries <- d
93 }
94 }
95}
96
97// NewConsumer Consumer's constructor
98func NewConsumer(q *Queue, opts ...ConsumerOpt) *Consumer {

Callers 9

TestConsumer_serve_qosFunction · 0.45
TestConsumer_serve_forFunction · 0.45
TestPublisher_serveFunction · 0.45
ConsumeMethod · 0.45
PublishMethod · 0.45
LoopMethod · 0.45

Calls 5

reportErrMethod · 0.95
QosMethod · 0.65
ConsumeMethod · 0.65
deleteConsumerMethod · 0.65
CloseMethod · 0.65

Tested by 6

TestConsumer_serve_qosFunction · 0.36
TestConsumer_serve_forFunction · 0.36
TestPublisher_serveFunction · 0.36