Moved input/output channel configuration to Method-level annotations. Also, the @Poller annotation is now expected at Method-level instead of Class-level. The @MessageEndpoint is now strictly a stereotype. Removed the @MessageTarget and @Pollable annotations. The @ChannelAdapter annotation post-processor now handles both inbound and outbound channel adapters based on the Method signature.
This commit is contained in:
@@ -24,10 +24,10 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
/**
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
@MessageEndpoint(input = "preparedDrinks",output = "deliveries")
|
||||
@MessageEndpoint
|
||||
public class DeliveryAssembler {
|
||||
|
||||
@Aggregator
|
||||
@Aggregator(inputChannel = "preparedDrinks", outputChannel = "deliveries")
|
||||
public Delivery prepareDelivery(List<Drink> drinks) {
|
||||
return new Delivery(drinks);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ import org.springframework.integration.annotation.Router;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@MessageEndpoint(input="drinks")
|
||||
@MessageEndpoint
|
||||
public class DrinkRouter {
|
||||
|
||||
@Router
|
||||
@Router(inputChannel="drinks")
|
||||
public String resolveOrderItemChannel(OrderItem orderItem) {
|
||||
return (orderItem.isIced()) ? "coldDrinks" : "hotDrinks";
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ import org.springframework.integration.annotation.Splitter;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@MessageEndpoint(input="orders", output="drinks")
|
||||
@MessageEndpoint
|
||||
public class OrderSplitter {
|
||||
|
||||
@Splitter
|
||||
@Splitter(inputChannel="orders", outputChannel="drinks")
|
||||
public List<OrderItem> split(Order order) {
|
||||
return order.getDrinks();
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@MessageEndpoint(input="tickers", output="quotes")
|
||||
@MessageEndpoint
|
||||
public class QuoteService {
|
||||
|
||||
@Handler
|
||||
@Handler(inputChannel="tickers", outputChannel="quotes")
|
||||
public Quote lookupQuote(String ticker) {
|
||||
BigDecimal price = new BigDecimal(new Random().nextDouble() * 100);
|
||||
return new Quote(ticker, price.setScale(2, RoundingMode.HALF_EVEN));
|
||||
|
||||
@@ -20,18 +20,16 @@ import java.util.Random;
|
||||
|
||||
import org.springframework.integration.annotation.ChannelAdapter;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.Pollable;
|
||||
import org.springframework.integration.annotation.Poller;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@MessageEndpoint
|
||||
@ChannelAdapter("tickers")
|
||||
@Poller(period = 300)
|
||||
public class TickerStream {
|
||||
|
||||
@Pollable
|
||||
@ChannelAdapter("tickers")
|
||||
@Poller(period = 300)
|
||||
public String nextTicker() {
|
||||
char[] chars = new char[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
Reference in New Issue
Block a user