Package org.springframework.integration.redis.outbound

Examples of org.springframework.integration.redis.outbound.RedisPublishingMessageHandler


  }

  @Test
  public void testWithDefaultSerializer() throws Exception {
    setupListener(new StringRedisSerializer());
    final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
    handler.setBeanFactory(BusTestUtils.MOCK_BF);
    handler.setTopic(TOPIC);
    handler.afterPropertiesSet();
    for (int i = 0; i < NUM_MESSAGES; i++) {
      handler.handleMessage(MessageBuilder.withPayload("test-" + i).build());
    }
    latch.await(3, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
    container.stop();
  }
View Full Code Here


  }

  @Test
  public void testWithNoSerializer() throws Exception {
    setupListener(null);
    final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
    handler.setBeanFactory(BusTestUtils.MOCK_BF);
    handler.setTopic(TOPIC);
    handler.afterPropertiesSet();
    for (int i = 0; i < NUM_MESSAGES; i++) {
      handler.handleMessage(MessageBuilder.withPayload(new String("test-" + i).getBytes()).build());
    }
    latch.await(3, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
    container.stop();
  }
View Full Code Here

  @Test
  public void testWithCustomSerializer() throws Exception {
    GenericToStringSerializer<Long> serializer = new GenericToStringSerializer<Long>(Long.class);
    setupListener(serializer);
    final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
    handler.setBeanFactory(BusTestUtils.MOCK_BF);
    handler.setTopic(TOPIC);
    handler.setSerializer(serializer);
    handler.afterPropertiesSet();
    for (long i = 0; i < NUM_MESSAGES; i++) {
      handler.handleMessage(MessageBuilder.withPayload(i).build());
    }
    latch.await(3, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());
    container.stop();
  }
View Full Code Here

  @Override
  public void bindPubSubProducer(final String name, MessageChannel moduleOutputChannel,
      Properties properties) {
    validateProducerProperties(name, properties, SUPPORTED_PUBSUB_PRODUCER_PROPERTIES);
    RedisPublishingMessageHandler topic = new RedisPublishingMessageHandler(connectionFactory);
    topic.setBeanFactory(this.getBeanFactory());
    topic.setTopic("topic." + name);
    topic.afterPropertiesSet();
    doRegisterProducer(name, moduleOutputChannel, topic, new RedisPropertiesAccessor(properties));
  }
View Full Code Here

TOP

Related Classes of org.springframework.integration.redis.outbound.RedisPublishingMessageHandler

Copyright © 2018 www.massapicom. 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.