2016-12-16 3 views
0

У меня есть пружинная конфигурация:Multiple исходящего адаптера стандартного вывода канал не работает

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:int="http://www.springframework.org/schema/integration" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int-stream="http://www.springframework.org/schema/integration/stream" 
    xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd 
    http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd"> 


    <!-- message producer/a Spring Integration wrapped Java Standard input 
     stream --> 
    <int-stream:stdin-channel-adapter id="producer" 
     channel="messageChannel" /> 

    <!-- a pair of message consumers/a pair of Spring Integration wrapped 
     Java Standard output streams --> 
    <int-stream:stdout-channel-adapter 
     id="consumer1" channel="messageChannel" append-newline="true" /> 
    <int-stream:stdout-channel-adapter 
     id="consumer2" channel="messageChannel" append-newline="true" /> 
    <int-stream:stdout-channel-adapter 
     id="consumer3" channel="messageChannel" append-newline="true" /> 

    <int:poller id="defaultPoller" default="true" 
     max-messages-per-poll="5" fixed-rate="200" /> 

    <!-- a pub/sub message channel --> 
    <!-- <int:publish-subscribe-channel id="messageChannel" /> --> 

    <!-- a direct channel without the queue, a pollable channel with the queue --> 
    <int:channel id="messageChannel"> 
     <!-- <int:queue capacity="2" /> --> 
    </int:channel> 
</beans> 

с исходным Java кодом:

public class Startup { 
    public static void main(String[] args) { 
     ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/si-components.xml"); 
     while (true) { 

     } 

    } 
} 

Однако, когда я запускаю приведенный выше код и дать вход со стандартного ввода, Я получаю только один ответ обратно в stdout. Что я делаю не так. Исходный код получается из:

https://www.intertech.com/Blog/spring-integration-part-1-understanding-channels/

Благодарности

ответ

0

Моя ошибка.

Следующая была закомментирована:

<!-- a pub/sub message channel --> 
<!-- <int:publish-subscribe-channel id="messageChannel" /> --> 
+0

Я просто хочу сказать, что :) - когда нет канала боб, простой 'DirectChannel' автоматически объявлен (по умолчанию). –

Смежные вопросы