List of usage examples for org.springframework.amqp.rabbit.core RabbitTemplate convertAndSend
@Override public void convertAndSend(Object object) throws AmqpException
From source file:cn.com.inhand.devicenetworks.ap.mq.rabbitmq.TaskNotificationConsumer.java
public static void main(String[] agrs) throws Exception { String path = "file:/home/han/myworks/workroom/NetBeansProjects/WSAP/RabbitMQDemo/RabbitMQDemo/src/main/webapp/WEB-INF/MQXMLApplicationContext.xml"; AbstractApplicationContext ctx = new FileSystemXmlApplicationContext(path); RabbitTemplate template = ctx.getBean(RabbitTemplate.class); template.convertAndSend("Hello, world!"); Thread.sleep(1000);/*from ww w .ja v a 2 s. co m*/ ctx.destroy(); }
From source file:com.anton.dev.tqrbs2.basic.BasicSpring.java
public static void main(String[] args) throws Exception { AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("basic-context.xml"); RabbitTemplate template = ctx.getBean(RabbitTemplate.class); String msg = "Hello, world Rabbit!"; LOGGER.info("Enviando Spring: " + msg); template.convertAndSend(msg); Thread.sleep(1000);/*from ww w . j a v a 2s .c o m*/ ctx.destroy(); }
From source file:com.harpatec.examples.Main.java
private static void submitMessage(RabbitTemplate inboundTemplate, Map<String, Object> messageMap) throws JsonGenerationException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); String payload = mapper.writeValueAsString(messageMap); LOGGER.debug("Writing message to inbound queue\n" + payload); inboundTemplate.convertAndSend(payload); }
From source file:org.springframework.amqp.rabbit.admin.RabbitTemplateProducerExample.java
public static void main(String[] args) throws Exception { ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext( RabbitProducerConfiguration.class); RabbitTemplate template = ctx.getBean(RabbitTemplate.class); for (int i = 1; i <= 10; i++) { template.convertAndSend("test-" + i); Thread.sleep(100);/* w w w .ja va2s. c om*/ } log.debug("done sending"); ctx.stop(); System.exit(0); }