mirror of
https://github.com/oarkflow/mq.git
synced 2025-09-26 20:11:16 +08:00
feat: update
This commit is contained in:
@@ -46,11 +46,11 @@ func NewConsumer(id string, queue string, handler Handler, opts ...Option) *Cons
|
||||
}
|
||||
|
||||
func (c *Consumer) send(conn net.Conn, msg *codec.Message) error {
|
||||
return codec.SendMessage(conn, msg, c.opts.aesKey, c.opts.hmacKey, c.opts.enableEncryption)
|
||||
return codec.SendMessage(conn, msg)
|
||||
}
|
||||
|
||||
func (c *Consumer) receive(conn net.Conn) (*codec.Message, error) {
|
||||
return codec.ReadMessage(conn, c.opts.aesKey, c.opts.hmacKey, c.opts.enableEncryption)
|
||||
return codec.ReadMessage(conn)
|
||||
}
|
||||
|
||||
func (c *Consumer) Close() error {
|
||||
@@ -66,7 +66,7 @@ func (c *Consumer) subscribe(ctx context.Context, queue string) error {
|
||||
headers := HeadersWithConsumerID(ctx, c.id)
|
||||
msg := codec.NewMessage(consts.SUBSCRIBE, utils.ToByte("{}"), queue, headers)
|
||||
if err := c.send(c.conn, msg); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("error while trying to subscribe: %v", err)
|
||||
}
|
||||
return c.waitForAck(c.conn)
|
||||
}
|
||||
|
Reference in New Issue
Block a user