adjust / rmq

Message queue system written in Go and backed by Redis
MIT License
1.57k stars 206 forks source link

Is the queue thread-safe? #130

Closed QuanTran91 closed 1 year ago

QuanTran91 commented 2 years ago

Hi everyone,

In the document, in order to add message to the queue, we had to open the queue and then publish the message (as the code below) taskQueue, err := connection.OpenQueue("tasks") taskQueue.PublishBytes(byteData)

My question is: Should the queue be opened per request or can we share it among incoming requests (singleton)?

Thanks.

wellle commented 2 years ago

Yes it is thread-safe and you can reuse Connection and Queue objects concurrently.