haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.09k stars 661 forks source link

RabbitMQ #1457

Closed erickpece closed 8 years ago

erickpece commented 8 years ago

Haraka version

2.8.0

Expected behavior

If message(s) should be relayed, send them to RabbitMQ for queueing.

Observed behavior

Loading outbound queue fails with the following error:

[NOTICE] [-] [core] Listening on :::25 [DEBUG] [-] [server] running init_master hooks [INFO] [-] [core] [outbound] Loading outbound queue from /usr/local/haraka/queue [CRIT] [-] [core] TypeError: Cannot read property 'close' of undefined [CRIT] [-] [core] at /usr/lib/node_modules/Haraka/plugins/queue/rabbitmq_amqplib.js:39:24 [CRIT] [-] [core] at /usr/lib/node_modules/amqplib/callback_api.js:16:10 [CRIT] [-] [core] at Socket. (/usr/lib/node_modules/amqplib/lib/connect.js:167:18) [CRIT] [-] [core] at Socket.g (events.js:273:16) [CRIT] [-] [core] at emitOne (events.js:90:13) [CRIT] [-] [core] at Socket.emit (events.js:182:7) [CRIT] [-] [core] at emitErrorNT (net.js:1265:8) [CRIT] [-] [core] at _combinedTickCallback (internal/process/next_tick.js:74:11) [CRIT] [-] [core] at process._tickCallback (internal/process/next_tick.js:98:9)

Steps to reproduce

Add queue/rabbitmq_amqplib to plugins before max_unrecognized_commands

Apply the default configuration for rabbitmq_amqplib as seen at https://haraka.github.io/manual/plugins/queue/rabbitmq_amqplib.html

gramakri commented 8 years ago

https://github.com/haraka/Haraka/blob/master/plugins/queue/rabbitmq_amqplib.js#L39 must be changed to just be return.

Also, https://github.com/haraka/Haraka/blob/master/plugins/queue/rabbitmq_amqplib.js#L14 needs a null check for channel (if the amqp connection had failed).

rdrgmnzs commented 8 years ago

For whatever damn reason the plugin wants rabbitmq_amqplib.ini and rabbitmq.ini to be the same. So:

cp rabbitmq_amqplib.ini rabbitmq.ini

erickpece commented 8 years ago

@brdude Thanks - that workaround took care of it for me!

baudehlo commented 8 years ago

@gramakri - can you do a PR with those changes please?

gramakri commented 8 years ago

@baudehlo I was only pointing out the bug :-) I don't use amqp and have never used it.

That said, I can still do a PR if someone else is willing to test it.