feat: update

This commit is contained in:
sujit
2024-10-14 05:54:01 +05:45
parent d910a2656b
commit a5bc632b1e
10 changed files with 92 additions and 241 deletions

View File

@@ -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)
}