Examples of MessageListenerAdapter


Examples of org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter

    }

    final SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(
        template.getConnectionFactory());
    PojoListener listener = new PojoListener(failFrequency);
    container.setMessageListener(new MessageListenerAdapter(listener));
    container.setAcknowledgeMode(AcknowledgeMode.AUTO);
    container.setChannelTransacted(true);
    container.setTxSize(txSize);
    container.setConcurrentConsumers(concurrentConsumers);
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter

    this.latch = new CountDownLatch(4);
    ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("retry-context.xml", this.getClass());
    RabbitTemplate template = ctx.getBean(RabbitTemplate.class);
    ConnectionFactory connectionFactory = ctx.getBean(ConnectionFactory.class);
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setMessageListener(new MessageListenerAdapter(new POJO()));
    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();

    // use an external template so we can share his cache
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter

    this.latch = new CountDownLatch(6);
    ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("retry-context.xml", this.getClass());
    RabbitTemplate template = ctx.getBean(RabbitTemplate.class);
    ConnectionFactory connectionFactory = ctx.getBean(ConnectionFactory.class);
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setMessageListener(new MessageListenerAdapter(new POJO()));
    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();

    // use an external template so we can share his cache
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter

      return new RabbitListenerContainerTestFactory();
    }

    @Bean
    public MessageListener simpleMessageListener() {
      return new MessageListenerAdapter();
    }
View Full Code Here

Examples of org.springframework.data.redis.listener.adapter.MessageListenerAdapter

    this.redisTemplate = template;
    return template;
  }

  private void setupMessageListener(CountDownLatch latch, String topic) throws InterruptedException {
    MessageListenerAdapter listener = new MessageListenerAdapter();
    listener.setDelegate(new Listener(latch));
    listener.afterPropertiesSet();

    this.container = new RedisMessageListenerContainer();
    container.setConnectionFactory(this.redisAvailableRule.getResource());
    container.afterPropertiesSet();
    container.addMessageListener(listener, Collections.<Topic> singletonList(new ChannelTopic(topic)));
View Full Code Here

Examples of org.springframework.data.redis.listener.adapter.MessageListenerAdapter

    assertEquals(0, latch.getCount());
    container.stop();
  }

  private void setupListener(RedisSerializer<?> listenerSerializer) throws InterruptedException {
    MessageListenerAdapter listener = new MessageListenerAdapter();
    listener.setDelegate(new Listener(latch));
    listener.setSerializer(listenerSerializer);
    listener.afterPropertiesSet();

    this.container = new RedisMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);
    container.afterPropertiesSet();
    container.addMessageListener(listener, Collections.<Topic> singletonList(new ChannelTopic(TOPIC)));
View Full Code Here

Examples of org.springframework.data.redis.listener.adapter.MessageListenerAdapter

    // container stop
    for (int i = 0; i < 8; i++) {
      RedisMessageListenerContainer container = new RedisMessageListenerContainer();
      container.setConnectionFactory(connectionFactory);
      container.setBeanName("container" + i);
      container.addMessageListener(new MessageListenerAdapter(handler), Arrays.asList(new ChannelTopic(CHANNEL)));
      container.setTaskExecutor(new SyncTaskExecutor());
      container.setSubscriptionExecutor(new SimpleAsyncTaskExecutor());
      container.afterPropertiesSet();
      container.start();
View Full Code Here

Examples of org.springframework.data.redis.listener.adapter.MessageListenerAdapter

  }

  @Test
  public void testRemoveLastListener() throws Exception {
    // Grab all 8 connections from the pool
    MessageListener listener = new MessageListenerAdapter(handler);
    for (int i = 0; i < 8; i++) {
      RedisMessageListenerContainer container = new RedisMessageListenerContainer();
      container.setConnectionFactory(connectionFactory);
      container.setBeanName("container" + i);
      container.addMessageListener(listener, Arrays.asList(new ChannelTopic(CHANNEL)));
View Full Code Here

Examples of org.springframework.data.redis.listener.adapter.MessageListenerAdapter

  }

  @Test
  public void testStopListening() throws InterruptedException {
    // Grab all 8 connections from the pool.
    MessageListener listener = new MessageListenerAdapter(handler);
    for (int i = 0; i < 8; i++) {
      RedisMessageListenerContainer container = new RedisMessageListenerContainer();
      container.setConnectionFactory(connectionFactory);
      container.setBeanName("container" + i);
      container.addMessageListener(listener, Arrays.asList(new ChannelTopic(CHANNEL)));
View Full Code Here

Examples of org.springframework.data.redis.listener.adapter.MessageListenerAdapter

    final String PATTERN = "p*";
    final String ANOTHER_CHANNEL = "pubsub::test::extra";

    BlockingDeque<String> bag2 = new LinkedBlockingDeque<String>(99);
    MessageListenerAdapter anotherListener = new MessageListenerAdapter(new MessageHandler("handler2", bag2));
    anotherListener.setSerializer(template.getValueSerializer());
    anotherListener.afterPropertiesSet();

    // remove adapter from all channels
    container.addMessageListener(anotherListener, new PatternTopic(PATTERN));
    container.removeMessageListener(adapter);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.