erlang - ejabberd - module gen_mod & gen_server with RabbitMq -
i'm developing ejabberd module can send queue directly rabbitmq using ejabberd hook gen_mod behaviour. queue can sent without issue. however, connection rabbitmq server not persistent. sample working code per following : -module(mod_rab). -author('author@domain.com'). -behaviour(gen_mod). -export([start/2, init/2, stop/1, send_available_notice/4]). -define(procname, ?module). -include("ejabberd.hrl"). -include("jlib.hrl"). -include("logger.hrl"). -include("amqp_client.hrl"). start(host, opts) -> ?info_msg("starting mod_rab testing", [] ), register(?procname,spawn(?module, init, [host, opts])), ok. init(host, _opts) -> inets:start(), ssl:start(), ejabberd_hooks:add(set_presence_hook, host, ?module, send_available_notice, 10), ok. stop(host) -> ?info_msg("stopping mod_rab testing", [] ), ejabberd_hooks:delete(set_presence_hook, host, ...