Skip to content

Instantly share code, notes, and snippets.

View julianazanelatto's full-sized avatar

JulianaM julianazanelatto

View GitHub Profile
sql_insert = text("insert into user values(2,'Maria','email@email.com','Ma')")
engine.execute(sql_insert)
//bindingkey da dlx e consumer
channel.queueBind(DLX_QUEUE,DLX_NAME,DLX_BINDING_KEY+".#");
channel.queueBind(CONSUMER_QUEUE,EXCHANGE_NAME,CONSUMER_BINDING_KEY+".#");
connection.close();
Map<String, Object> map = new HashMap<String,Object>();
map.put("x-message-ttl",10000);
map.put("x-dead-letter-exchange",DLX_NAME);
map.put("x-dead-letter-routing-key",DLX_BINDING_KEY);
channel.queueDeclare(CONSUMER_QUEUE,false,false,false,map);
//declarar as exchanges (main e dlx)
channel.exchangeDeclare(DLX_NAME,"topic");
channel.exchangeDeclare(EXCHANGE_NAME,"topic");
//declarar as filas: consumer, dlx
channel.queueDeclare(DLX_QUEUE,false,false,false,null);
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("172.24.0.2");
factory.setUsername("admin");
factory.setPassword("pass123");
factory.setPort(5672);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
package DLX;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
# RabbitMQ properties
services:
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq_management
ports:
- 25672:25672 # (erlang) communication between the nodes and CLI tool
- 15672:15672 # communication with the web management API