consumer constructor

This commit is contained in:
nquidox 2026-02-20 16:20:09 +03:00
parent 9366cbbf6d
commit 4c5b1c7030
2 changed files with 22 additions and 8 deletions

View file

@ -64,13 +64,10 @@ func NewClient(addr, queueName string, opts ...Option) (*Client, error) {
return &client, nil
}
func StartConsumer(ctx context.Context, client *Client, chanLen int) chan []byte {
msgCh := make(chan []byte, chanLen)
go runConsumer(ctx, client, msgCh)
return msgCh
}
func NewPublisher(client *Client) Publisher {
return &PubHandler{client: client}
return &pubHandler{client: client}
}
func NewConsumer(ctx context.Context, client *Client, chanLen int) Consumer {
return &consumeHandler{ctx: ctx, client: client, chanLen: chanLen}
}