Channel Adapters are now endpoints, but if no "channel" attribute if provided for a <channel-adapter/> element, a DirectChannel will be created automatically. The <poller/> sub-element now belongs within the <channel-adapter/> (not the consumer endpoint downstream). This enables support for multiple Channel Adapters to share a MessageChannel. Also, the @Poller annotation belongs at class-level along with @ChannelAdapter if a @Pollable method is being adapted via MethodInvokingSource.
This commit is contained in:
@@ -11,13 +11,13 @@
|
||||
|
||||
<message-bus/>
|
||||
|
||||
<channel-adapter id="channel1" source="fileSource"/>
|
||||
<channel-adapter id="channel1" source="fileSource">
|
||||
<poller period="5000"/>
|
||||
</channel-adapter>
|
||||
|
||||
<service-activator input-channel="channel1"
|
||||
output-channel="channel2"
|
||||
ref="exclaimer" method="exclaim">
|
||||
<poller period="5000"/>
|
||||
</service-activator>
|
||||
ref="exclaimer" method="exclaim"/>
|
||||
|
||||
<channel-adapter id="channel2" target="fileTarget"/>
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
<channel id="even"/>
|
||||
<channel id="odd"/>
|
||||
|
||||
<channel-adapter id="numbers" source="counter"/>
|
||||
|
||||
<router ref="parityResolver" method="getParity" input-channel="numbers">
|
||||
<channel-adapter id="numbers" source="counter">
|
||||
<poller period="3000" max-messages-per-poll="1"/>
|
||||
</router>
|
||||
</channel-adapter>
|
||||
|
||||
<router ref="parityResolver" method="getParity" input-channel="numbers"/>
|
||||
|
||||
<service-activator ref="oddLogger" input-channel="odd"/>
|
||||
|
||||
|
||||
@@ -22,13 +22,11 @@ import java.util.Random;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.Poller;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@MessageEndpoint(input="tickers", output="quotes")
|
||||
@Poller(period=300)
|
||||
public class QuoteService {
|
||||
|
||||
@Handler
|
||||
|
||||
@@ -20,11 +20,13 @@ import java.util.Random;
|
||||
|
||||
import org.springframework.integration.annotation.ChannelAdapter;
|
||||
import org.springframework.integration.annotation.Pollable;
|
||||
import org.springframework.integration.annotation.Poller;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@ChannelAdapter("tickers")
|
||||
@Poller(period = 300)
|
||||
public class TickerStream {
|
||||
|
||||
@Pollable
|
||||
|
||||
Reference in New Issue
Block a user