File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1+
2+ .PHONY : reset
3+ reset :
4+ rabbitmqctl stop_app
5+ rabbitmqctl reset
6+ rabbitmqctl start_app
Original file line number Diff line number Diff line change @@ -63,7 +63,6 @@ func NewWorker(opts ...Option) *Worker {
6363
6464func (w * Worker ) startConsumer () (err error ) {
6565 w .startOnce .Do (func () {
66- var err error
6766 q , err := w .channel .QueueDeclare (
6867 w .opts .subj , // name
6968 true , // durable
@@ -80,7 +79,7 @@ func (w *Worker) startConsumer() (err error) {
8079 w .tasks , err = w .channel .Consume (
8180 q .Name , // queue
8281 w .opts .tag , // consumer
83- true , // auto-ack
82+ false , // auto-ack
8483 false , // exclusive
8584 false , // no-local
8685 false , // no-wait
@@ -161,7 +160,7 @@ func (w *Worker) Shutdown() error {
161160
162161 w .stopOnce .Do (func () {
163162 close (w .stop )
164- if err := w .channel .Cancel ("" , true ); err != nil {
163+ if err := w .channel .Cancel (w . opts . tag , true ); err != nil {
165164 w .opts .logger .Error (err )
166165 }
167166 if err := w .conn .Close (); err != nil {
@@ -189,7 +188,7 @@ func (w *Worker) Queue(job core.QueuedMessage) error {
189188 return err
190189 }
191190
192- return w .channel .Publish (
191+ err = w .channel .Publish (
193192 "" , // exchange
194193 q .Name , // routing key
195194 false , // mandatory
@@ -198,6 +197,8 @@ func (w *Worker) Queue(job core.QueuedMessage) error {
198197 ContentType : "text/plain" ,
199198 Body : job .Bytes (),
200199 })
200+
201+ return err
201202}
202203
203204// Request a new task
You can’t perform that action at this time.
0 commit comments