MCPcopy
hub / github.com/mudler/LocalAI / QueueSubscribe

Method QueueSubscribe

core/services/messaging/client.go:170–176  ·  view source on GitHub ↗

QueueSubscribe creates a queue subscription. Within the same queue group, only one subscriber receives each message (load-balanced).

(subject, queue string, handler func([]byte))

Source from the content-addressed store, hash-verified

168// QueueSubscribe creates a queue subscription. Within the same queue group,
169// only one subscriber receives each message (load-balanced).
170func (c *Client) QueueSubscribe(subject, queue string, handler func([]byte)) (Subscription, error) {
171 return c.confirmSubscription(subject, func(conn *nats.Conn) (*nats.Subscription, error) {
172 return conn.QueueSubscribe(subject, queue, func(msg *nats.Msg) {
173 handler(msg.Data)
174 })
175 })
176}
177
178// confirmSubscription creates a subscription via mk and forces a server
179// round-trip so that a permissions violation — which NATS otherwise reports

Callers

nothing calls this directly

Calls 3

confirmSubscriptionMethod · 0.95
QueueSubscribeMethod · 0.65
handlerFunction · 0.50

Tested by

no test coverage detected