The @Polled annotation has been renamed @Poller (it no longer applies directly to a method).

This commit is contained in:
Mark Fisher
2008-08-05 21:30:44 +00:00
parent 1e82a8d568
commit 528f5e6341
5 changed files with 22 additions and 22 deletions

View File

@@ -29,7 +29,7 @@ import org.springframework.integration.scheduling.PollingSchedule;
/**
* Annotation that can be specified at class-level alongside a
* {@link MessageEndpoint @MessageEndpoint} annotation in order to provide the
* scheduling information for that endpoint.
* polling metadata and scheduling information for that endpoint.
*
* @author Mark Fisher
*/
@@ -37,7 +37,7 @@ import org.springframework.integration.scheduling.PollingSchedule;
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Polled {
public @interface Poller {
int period() default 0;

View File

@@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.integration.annotation.Polled;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.bus.MessageBus;
import org.springframework.integration.scheduling.PollingSchedule;
import org.springframework.integration.scheduling.Schedule;
@@ -99,12 +99,12 @@ public abstract class AbstractAnnotationMethodPostProcessor<T> implements Annota
protected Schedule extractSchedule(Class<?> originalBeanClass) {
PollingSchedule schedule = null;
Polled polledAnnotation = AnnotationUtils.findAnnotation(originalBeanClass, Polled.class);
if (polledAnnotation != null) {
schedule = new PollingSchedule(polledAnnotation.period());
schedule.setInitialDelay(polledAnnotation.initialDelay());
schedule.setFixedRate(polledAnnotation.fixedRate());
schedule.setTimeUnit(polledAnnotation.timeUnit());
Poller pollerAnnotation = AnnotationUtils.findAnnotation(originalBeanClass, Poller.class);
if (pollerAnnotation != null) {
schedule = new PollingSchedule(pollerAnnotation.period());
schedule.setInitialDelay(pollerAnnotation.initialDelay());
schedule.setFixedRate(pollerAnnotation.fixedRate());
schedule.setTimeUnit(pollerAnnotation.timeUnit());
}
return schedule;
}

View File

@@ -27,7 +27,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.Polled;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.bus.MessageBus;
import org.springframework.integration.channel.ChannelRegistryAware;
import org.springframework.integration.channel.MessageChannel;
@@ -91,18 +91,18 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Init
postProcessor.createEndpoint(bean, beanName, beanClass, endpointAnnotation);
if (endpoint != null) {
endpoint.setName(beanName + "." + entry.getKey().getSimpleName() + ".endpoint");
Polled polledAnnotation = AnnotationUtils.findAnnotation(beanClass, Polled.class);
if (polledAnnotation != null) {
PollingSchedule schedule = new PollingSchedule(polledAnnotation.period());
schedule.setInitialDelay(polledAnnotation.initialDelay());
schedule.setFixedRate(polledAnnotation.fixedRate());
schedule.setTimeUnit(polledAnnotation.timeUnit());
Poller pollerAnnotation = AnnotationUtils.findAnnotation(beanClass, Poller.class);
if (pollerAnnotation != null) {
PollingSchedule schedule = new PollingSchedule(pollerAnnotation.period());
schedule.setInitialDelay(pollerAnnotation.initialDelay());
schedule.setFixedRate(pollerAnnotation.fixedRate());
schedule.setTimeUnit(pollerAnnotation.timeUnit());
String inputChannelName = endpointAnnotation.input();
MessageChannel inputChannel = this.messageBus.lookupChannel(inputChannelName);
if (inputChannel != null) {
if (inputChannel instanceof PollableChannel) {
PollingDispatcher poller = new PollingDispatcher((PollableChannel) inputChannel, schedule);
poller.setMaxMessagesPerPoll(polledAnnotation.maxMessagesPerPoll());
poller.setMaxMessagesPerPoll(pollerAnnotation.maxMessagesPerPoll());
endpoint.setSource(poller);
}
else {

View File

@@ -45,7 +45,7 @@ import org.springframework.integration.annotation.Handler;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.MessageTarget;
import org.springframework.integration.annotation.Pollable;
import org.springframework.integration.annotation.Polled;
import org.springframework.integration.annotation.Poller;
import org.springframework.integration.annotation.Splitter;
import org.springframework.integration.annotation.Transformer;
import org.springframework.integration.bus.DefaultMessageBus;
@@ -355,7 +355,7 @@ public class MessagingAnnotationPostProcessorTests {
}
@Test
public void testEndpointWithPolledAnnotation() {
public void testEndpointWithPollerAnnotation() {
MessageBus messageBus = new DefaultMessageBus();
QueueChannel testChannel = new QueueChannel();
messageBus.registerChannel("testChannel", testChannel);
@@ -489,7 +489,7 @@ public class MessagingAnnotationPostProcessorTests {
@MessageEndpoint(input="testChannel")
@Polled(period=1234, initialDelay=5678, fixedRate=true, timeUnit=TimeUnit.SECONDS)
@Poller(period=1234, initialDelay=5678, fixedRate=true, timeUnit=TimeUnit.SECONDS)
private static class AnnotatedEndpointWithPolledAnnotation {
@Handler