Subscribe creates a subscription on the given subject. All subscribers receive every message.
(subject string, handler func([]byte))
| 158 | |
| 159 | // Subscribe creates a subscription on the given subject. All subscribers receive every message. |
| 160 | func (c *Client) Subscribe(subject string, handler func([]byte)) (Subscription, error) { |
| 161 | return c.confirmSubscription(subject, func(conn *nats.Conn) (*nats.Subscription, error) { |
| 162 | return conn.Subscribe(subject, func(msg *nats.Msg) { |
| 163 | handler(msg.Data) |
| 164 | }) |
| 165 | }) |
| 166 | } |
| 167 | |
| 168 | // QueueSubscribe creates a queue subscription. Within the same queue group, |
| 169 | // only one subscriber receives each message (load-balanced). |
nothing calls this directly
no test coverage detected