tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

why @Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT) not inversely

Open liaoxu opened this issue 7 years ago • 3 comments

I'm not quite understand the ProcessorApp in the spring cloud stream demo, why the annotation there is @Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT) not @Transformer(inputChannel = Processor.OUTPUT, outputChannel = Processor.INPUT)

I thought the upstream of ProcessorApp is SourceApp, and the output of that was "output" channel, so the ProcessorApp should read "output" named channel not the one "input" (Processor.INPUT), is that right?

Thanks in advance.

liaoxu avatar Dec 21 '18 08:12 liaoxu

@liaoxu could you please let us know which article are you referring to? And which class?

maibin avatar Dec 21 '18 17:12 maibin

tutorials/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/main/java/com/baeldung/twitterhdfs/processor/ProcessorApp.java

the article is https://www.baeldung.com/spring-cloud-data-flow-stream-processing

liaoxu avatar Dec 24 '18 02:12 liaoxu

@liaoxu,

You're correct on your assumption that data flows from a Source to the Processor and eventually to a Sink. The ProcessorApp however, works much like a delegate for the actual processing done at the Processor stage so this is reason we bind its channels in the way we see in code. If you're still not convinced, take another look at the SourceApp in the same project: it's InboundChannelAdapter uses Source.OUTPUT as the destination channel.

I hope this made things a bit clearer for you.

psevestre avatar Jan 09 '19 00:01 psevestre