gotthardp/rabbitmq-email

Release 0.2.0 not compatible with Erlang 21

gbhat618 opened this issue · 5 comments

Erlang Version Info: 21

$erl
Erlang/OTP 21 [erts-10.3.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Eshell V10.3.1  (abort with ^G)
1> 

Rabbitmq version: 3.7.13

$rabbitmqctl status | grep rabbit
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Status of node rabbit@vm-gbbhat-003 ...
     [{rabbitmq_email," E-mail gateway for AMQP 0-9-1","0.2.0"},
      {rabbitmq_management,"RabbitMQ Management Console","3.7.13"},
      {rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.13"},
      {rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.13"},
      {rabbit,"RabbitMQ","3.7.13"},
      {rabbit_common,
          "Modules shared by rabbitmq-server and rabbitmq-erlang-client",

vHost, Exchange, Queues:
vHost : /
Exchange: email-in (topic exchange type)
Queue: my_emails (binded with key - #)

I am sending emails from the erl shell from directory where the gen_smtp beam files are available.

/var/lib/rabbitmq/mnesia/rabbit@vm-gbbhat-003-plugins-expand/gen_smtp-0.12.0/ebin

it looks like,

Eshell V10.3.1  (abort with ^G)
1> 
1> gen_smtp_client:send({"fromme@example.com", ["tome@example.com"], "Subject: Testing\r\nFrom: Me \r\nTo: Me \r\n\r\nThis is the email body"}, [{relay, "localhost"}, {port, 2525}, {ssl, false}]).
{ok,<0.82.0>}
2> 

Rabbitmq logs show the error like,

2019-03-29 10:47:00.447 [info] <0.3402.0> example.com SMTP connection from {127,0,0,1}
2019-03-29 10:47:00.453 [info] <0.3402.0> EHLO from vm-gbbhat-003.cisco.com
2019-03-29 10:47:00.456 [info] <0.3402.0> text/plain message from fromme@example.com to [<<"tome@example.com">>] queued as 43450ebdb1c4bb11f9299ebc5f98a0fe
2019-03-29 10:47:00.478 [error] <0.3403.0> ** Generic server <0.3403.0> terminating 
** Last message in was {'$gen_cast',{"43450ebdb1c4bb11f9299ebc5f98a0fe",[<<"tome@example.com">>],<<"text/plain">>,[{<<"Subject">>,<<"Testing">>},{<<"From">>,<<"Me">>},{<<"charset">>,<<"us-ascii">>}],<<"This is the email body">>}}
** When Server state == {state,<0.3406.0>,<0.3421.0>,<<"email-in">>}
** Reason for termination == 
** {'module could not be loaded',[{time_compat,timestamp,[],[]},{rabbit_message_sender,amqp_ts,0,[{file,"src/rabbit_message_sender.erl"},{line,82}]},{rabbit_message_sender,'-handle_cast/2-fun-1-',7,[{file,"src/rabbit_message_sender.erl"},{line,56}]},{lists,foreach,2,[{file,"lists.erl"},{line,1338}]},{rabbit_message_sender,handle_cast,2,[{file,"src/rabbit_message_sender.erl"},{line,50}]},{gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,637}]},{gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,711}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}
2019-03-29 10:47:00.479 [error] <0.3403.0> CRASH REPORT Process <0.3403.0> with 0 neighbours crashed with reason: call to undefined function time_compat:timestamp()

I am trying to use rabbitmq-email only for receiving emails and putting them into queues, from there depending on the email content I will be taking actions.

Please help.

Archive.zip has - configuration file and logs.

Archive.zip

How did you build and install the rabbitmq_email plugin?

I downloaded the .ez files from this repository itself, (https://github.com/gotthardp/rabbitmq-email/releases)
gen_smtp-0.12.0.ez
rabbitmq_email-0.2.0.ez
copied the downloaded .ez files to

/usr/lib/rabbitmq/lib/rabbitmq_server-3.7.13/plugins

and
executed

rabbitmq-plugins list 

to ensure that the rabbitmq_email plugin gets detected.
and enabled the plugin with,

rabbitmq-plugins enable rabbitmq_email

and restarted the rabbitmq-server with

service rabbitmq-server restart

Thank you for the very detailed information. There is a chance those binaries aren't compatible with Erlang 21.X. I will investigate.

In the meantime, you could try compiling this library yourself. make dist will create the necessary .ez files.

Yes. It is working now.

How I built the plugins

I made sure all the checklist in here is met - https://www.rabbitmq.com/build-server.html#prerequisites
(erlang, elixir, gnumake, libxslt, xmlto, zip and unzip)

Then copied the plugins from plugins directory( within the local copy of the repository) to the rabbitmq plugins directory

Enabled the plugins

Restarted the server

I am using all the latest version for rabbitmq-server, erlang, and elixir.

Thanks a lot.