Sample entrance code of rabbitmq java client.

ConnectionFactory factory = new ConnectionFactory();
factory.setHost(rabbitHost);
factory.setPort(rabbitPort);
factory.setVirtualHost(rabbitVhost);
factory.setUsername(rabbitUser);
factory.setPassword(rabbitPassword);
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();

Refer to RabbitMQ JavaDoc for more.

BACK TO TOP
Post tagged with: java