Skip to content

Instantly share code, notes, and snippets.

@mwacc
Created July 12, 2013 12:45
Show Gist options
  • Save mwacc/5984183 to your computer and use it in GitHub Desktop.
Save mwacc/5984183 to your computer and use it in GitHub Desktop.
rabbitmq sample
/*
<dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>3.1.1</version>
</dependency>
</dependencies>
*/
ConnectionFactory factory = new ConnectionFactory();
factory.setUri("amqp://test:test@my.test");
Connection connection = factory.newConnection();
final Channel ngnixChannel = connection.createChannel();
final Channel visaChannel = connection.createChannel();
// queue, durable, exclusive, autoDelete, arguments
ngnixChannel.queueDeclare(MY_QUEUE_NAME, true, false, false, null);
ngnixChannel.basicPublish("", NGNIX_QUEUE_NAME, null, logProducer.getLog().getBytes());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment