daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Test
  2. public void test() throws Exception {
  3.     ConcurrentMessageListenerContainer<?, ?> container = (ConcurrentMessageListenerContainer<?, ?>) registry
  4.             .getListenerContainer("EmptyLegCommandFeed_V2");
  5.     container.stop();
  6.     @SuppressWarnings("unchecked")
  7.     AcknowledgingConsumerAwareMessageListener<String, String> messageListener = (AcknowledgingConsumerAwareMessageListener<String, String>) container
  8.             .getContainerProperties().getMessageListener();
  9.     CountDownLatch latch = new CountDownLatch(1);
  10.     container.getContainerProperties()
  11.             .setMessageListener(new AcknowledgingConsumerAwareMessageListener<String, String>() {
  12.  
  13.                 @Override
  14.                 public void onMessage(ConsumerRecord<String, String> data, Acknowledgment acknowledgment,
  15.                                       Consumer<?, ?> consumer) {
  16.                     messageListener.onMessage(data, acknowledgment, consumer);
  17.                     latch.countDown();
  18.                 }
  19.  
  20.             });
  21.     container.start();
  22.     template.send("EmptyLegCommandFeed_V2", "foo");
  23.     assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top