Rabbitmq
Installare rabbitmq
Scaricare il .deb da http://www.rabbitmq.com/server.html
dpkg -i rabbitmq-server_2.4.1-1_all.deb
scaricare i file .ez per tutti i plugin interessanti e copiarli nella cartella: /usr/lib/rabbitmq/lib/rabbitmq_server-2.4.1/plugins/
Plugin interessanti
- rabbitmq-management: aggiunge l'interfaccia web per amministrare rabbitmq sulla porta 55672
- rabbit_stomp: permette di ricevere/inviare messaggi con stomp
- rabbit_shovel: trasmette messaggi da un nodo rabbitmq ad un altro
Configurare rabbitmq
Il file di configurazione e' /etc/rabbitmq/rabbitmq.config e non esiste in una nuova installazione. Un esempio e':
[
{rabbit, [
{ssl_listeners, [5671]},
{ssl_options, [{cacertfile,"/etc/ssl/certs/tcs-chain.pem"},
{certfile,"/etc/ssl/certs/wutki.pem"},
{keyfile,"/etc/ssl/private/wutki.key"},
{verify,verify_peer},
{fail_if_no_peer_cert,false}]}
]},
{rabbit_management, [ {http_log_dir, "/var/log/rabbitmq/rabbit-mgmt"} ] },
{rabbit_shovel,
[{shovels,
[{avocado_order_shovel,
[{sources, [{broker, "amqp://guest:guest@wayf.unimore.it/"},
{declarations,
[{'queue.declare',
[{queue, <<"backup_orders">>},
durable]},
{'exchange.declare',
[{exchange, <<"incoming_orders">>},
{type, <<"direct">>},
durable]},
{'queue.bind',
[{exchange, <<"incoming_orders">>},
{queue, <<"backup_orders">>},
{routing_key, <<"warehouse">>}]}
]}]},
{destinations, [{broker, "amqp://guest:guest@localhost"},
{declarations,
[{'queue.declare',
[{queue, <<"warehouse_carpinteria">>},
durable]},
{'exchange.declare',
[{exchange, <<"incoming_orders">>},
{type, <<"direct">>},
durable]},
{'queue.bind',
[{exchange, <<"incoming_orders">>},
{queue, <<"warehouse_carpinteria">>},
{routing_key, <<"warehouse">>}]}
]}]},
{queue, <<"backup_orders">>},
{auto_ack, false},
{tx_size, 0},
{publish_properties, [{delivery_mode, 2}]},
{publish_fields, [{exchange, <<"incoming_orders">>},
{routing_key, <<"warehouse">>}]},
{reconnect_delay, 5}
]}
]
}]
}
%,
% {rabbit_shovel,
% [{shovels,
% [{wayf_shovel,
% [{sources, [{brokers,
% ["amqp://wayf.unimore.it"
% ]},
% {declarations,
% [{'queue.declare',
% [{queue, <<"wutki">>},
% durable]}
% ]}]},
% {destinations, [{broker, "amqp://"}
% ]}]},
% {queue, <<wutki>>}
% ]}
% ]
% }
].
Le righe che iniziano con % sono commenti. La parentesi quadre e graffe sono separate da virgole, salvo l'ultimo elemento.