RabbitMQ中初始化ConnectionFactory常用设置属性
初始化ConnectionFactory 代码
ConnectionFactory factory = new ConnectionFactory(); factory.setHost(ip); factory.setPort(5672); factory.setUsername("guest"); factory.setPassword("guest"); Connection connection = factory.newConnection();
factory.setHost(ip);设置调用主机地址
factory.setPort(5672);设置调用的端口
factory.setUsername("guest");设置调用的用户名
factory.setPassword("guest");设置调用的用户名对应的密码
Connection connection = factory.newConnection();