Implemented TriggerMessage with an EndpointPoller as its payload for convenience when triggering polling of an endpoint.
This commit is contained in:
@@ -18,7 +18,6 @@ package org.springframework.integration.endpoint;
|
||||
|
||||
import org.springframework.integration.dispatcher.BroadcastingDispatcher;
|
||||
import org.springframework.integration.dispatcher.PollingDispatcher;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.integration.message.Message;
|
||||
import org.springframework.integration.message.MessageSource;
|
||||
import org.springframework.integration.scheduling.PollingSchedule;
|
||||
@@ -36,7 +35,7 @@ public class EndpointTrigger extends PollingDispatcher {
|
||||
* Create an endpoint trigger with the specified {@link Schedule}.
|
||||
*/
|
||||
public EndpointTrigger(Schedule schedule) {
|
||||
super(new EndpointPollerMessageSource(), new BroadcastingDispatcher(), schedule);
|
||||
super(new TriggerSource(), new BroadcastingDispatcher(), schedule);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,11 +46,19 @@ public class EndpointTrigger extends PollingDispatcher {
|
||||
this(new PollingSchedule(interval));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an endpoint trigger that will run one time only when submitted to
|
||||
* a {@link org.springframework.integration.scheduling.TaskScheduler}.
|
||||
*/
|
||||
public EndpointTrigger() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
private static class EndpointPollerMessageSource implements MessageSource<EndpointPoller> {
|
||||
|
||||
private static class TriggerSource implements MessageSource<EndpointPoller> {
|
||||
|
||||
public Message<EndpointPoller> receive() {
|
||||
return new GenericMessage<EndpointPoller>(new EndpointPoller());
|
||||
return new TriggerMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.endpoint;
|
||||
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
|
||||
/**
|
||||
* A convenience Message implementation for sending a polling trigger
|
||||
* to an endpoint.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class TriggerMessage extends GenericMessage<EndpointPoller> {
|
||||
|
||||
public TriggerMessage() {
|
||||
super(new EndpointPoller());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user