container.start(); AsyncRabbitTemplate asyncTemplate = new AsyncRabbitTemplate(template, container); asyncTemplate.setEnableConfirms(true); asyncTemplate.setMandatory(true);
@Test @DirtiesContext public void testConvertWithConfirmDirect() throws Exception { this.asyncDirectTemplate.setEnableConfirms(true); RabbitConverterFuture<String> future = this.asyncDirectTemplate.convertSendAndReceive("sleep"); ListenableFuture<Boolean> confirm = future.getConfirm(); assertNotNull(confirm); assertTrue(confirm.get(10, TimeUnit.SECONDS)); checkConverterResult(future, "SLEEP"); }
@Test @DirtiesContext public void testConvertWithConfirm() throws Exception { this.asyncTemplate.setEnableConfirms(true); RabbitConverterFuture<String> future = this.asyncTemplate.convertSendAndReceive("sleep"); ListenableFuture<Boolean> confirm = future.getConfirm(); assertNotNull(confirm); assertTrue(confirm.get(10, TimeUnit.SECONDS)); checkConverterResult(future, "SLEEP"); }
@Test @DirtiesContext public void testMessageWithConfirm() throws Exception { this.asyncTemplate.setEnableConfirms(true); RabbitMessageFuture future = this.asyncTemplate .sendAndReceive(new SimpleMessageConverter().toMessage("sleep", new MessageProperties())); ListenableFuture<Boolean> confirm = future.getConfirm(); assertNotNull(confirm); assertTrue(confirm.get(10, TimeUnit.SECONDS)); checkMessageResult(future, "SLEEP"); }
@Test @DirtiesContext public void testMessageWithConfirmDirect() throws Exception { this.asyncDirectTemplate.setEnableConfirms(true); RabbitMessageFuture future = this.asyncDirectTemplate .sendAndReceive(new SimpleMessageConverter().toMessage("sleep", new MessageProperties())); ListenableFuture<Boolean> confirm = future.getConfirm(); assertNotNull(confirm); assertTrue(confirm.get(10, TimeUnit.SECONDS)); checkMessageResult(future, "SLEEP"); }