Package org.springframework.integration.channel

Examples of org.springframework.integration.channel.DirectChannel.subscribe()


    DirectChannel moduleInputChannel = new DirectChannel();
    messageBus.bindProducer("bad.0", moduleOutputChannel, null);
    messageBus.bindConsumer("bad.0", moduleInputChannel, null);
    Message<?> message = MessageBuilder.withPayload("bad").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar").build();
    final CountDownLatch latch = new CountDownLatch(3);
    moduleInputChannel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        latch.countDown();
        throw new RuntimeException("bad");
View Full Code Here


    properties.put("autoBindDLQ", "true");
    properties.put("maxAttempts", "1"); // disable retry
    properties.put("requeue", "false");
    DirectChannel moduleInputChannel = new DirectChannel();
    moduleInputChannel.setBeanName("dlqTest");
    moduleInputChannel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        throw new RuntimeException("foo");
      }
View Full Code Here

  @Test
  public void test() throws Exception {
    final List<Message<?>> messages = new ArrayList<Message<?>>();
    final CountDownLatch latch = new CountDownLatch(2);
    DirectChannel channel = new DirectChannel();
    channel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        messages.add(message);
        latch.countDown();
View Full Code Here

  @Test
  public void testContentTypeHeaderMapsToSiContentTypeHeader() throws Exception {
    final List<Message<?>> messages = new ArrayList<Message<?>>();
    final CountDownLatch latch = new CountDownLatch(1);
    DirectChannel channel = new DirectChannel();
    channel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        messages.add(message);
        latch.countDown();
View Full Code Here

  @Test
  public void testBinaryContent() throws Exception {
    final List<Message<?>> messages = new ArrayList<Message<?>>();
    final CountDownLatch latch = new CountDownLatch(1);
    DirectChannel channel = new DirectChannel();
    channel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        messages.add(message);
        latch.countDown();
View Full Code Here

  }

  @Test(expected = HttpServerErrorException.class)
  public void testErrorResponse() throws URISyntaxException {
    DirectChannel channel = new DirectChannel();
    channel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        throw new RuntimeException();
      }
View Full Code Here

  public void testCustomExecutor() throws Exception {
    final List<Message<?>> messages = new ArrayList<Message<?>>();
    final Set<String> threadNames = new HashSet<String>();
    final CountDownLatch latch = new CountDownLatch(1);
    DirectChannel channel = new DirectChannel();
    channel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        threadNames.add(Thread.currentThread().getName());
        messages.add(message);
View Full Code Here

  public void setUp() {
    messages.clear();
    this.connectionFactory = redisAvailableRule.getResource();
    DirectChannel outputChannel = new DirectChannel();
    outputChannel.setBeanFactory(BusTestUtils.MOCK_BF);
    outputChannel.subscribe(new TestMessageHandler());

    this.currentQueueName = QUEUE_NAME + ":" + System.nanoTime();

    adapter = new RedisQueueMessageDrivenEndpoint(currentQueueName, connectionFactory);
    adapter.setBeanFactory(BusTestUtils.MOCK_BF);
View Full Code Here

  public void resolveQueueChannel() {
    MessageChannel registered = resolver.resolveDestination("queue:foo");
    DirectChannel testChannel = new DirectChannel();
    final CountDownLatch latch = new CountDownLatch(1);
    final List<Message<?>> received = new ArrayList<Message<?>>();
    testChannel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        received.add(message);
        latch.countDown();
View Full Code Here

    addBinding(consumerBinding);
    ReceivingHandler convertingBridge = new ReceivingHandler();
    convertingBridge.setOutputChannel(moduleInputChannel);
    convertingBridge.setBeanName(channelName + ".bridge.handler");
    convertingBridge.afterPropertiesSet();
    bridgeToModuleChannel.subscribe(convertingBridge);
    consumerBinding.start();
  }

  /**
   * If retry is enabled, wrap the bridge channel in another that will invoke send() within
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.