Replaced the @Handler annotation with @ServiceActivator.
This commit is contained in:
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.samples.oddeven;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -25,7 +25,7 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@MessageEndpoint
|
||||
public class EvenLogger {
|
||||
|
||||
@Handler
|
||||
@ServiceActivator
|
||||
public void log(int i) {
|
||||
System.out.println("even: " + i);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.springframework.integration.samples.oddeven;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -25,7 +25,7 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@MessageEndpoint
|
||||
public class OddLogger {
|
||||
|
||||
@Handler
|
||||
@ServiceActivator
|
||||
public void log(int i) {
|
||||
System.out.println("odd: " + i);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.integration.samples.quartzoddeven;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -29,7 +29,7 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@MessageEndpoint
|
||||
public class EvenLogger {
|
||||
|
||||
@Handler
|
||||
@ServiceActivator
|
||||
public void log(int i) {
|
||||
System.out.println("even: " + i + " at " + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.integration.samples.quartzoddeven;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -29,7 +29,7 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@MessageEndpoint
|
||||
public class OddLogger {
|
||||
|
||||
@Handler
|
||||
@ServiceActivator
|
||||
public void log(int i) {
|
||||
System.out.println("odd: " + i + " at " + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Random;
|
||||
|
||||
import org.springframework.integration.annotation.Handler;
|
||||
import org.springframework.integration.annotation.MessageEndpoint;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -29,7 +29,7 @@ import org.springframework.integration.annotation.MessageEndpoint;
|
||||
@MessageEndpoint
|
||||
public class QuoteService {
|
||||
|
||||
@Handler(inputChannel="tickers", outputChannel="quotes")
|
||||
@ServiceActivator(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));
|
||||
|
||||
Reference in New Issue
Block a user