IN PROGRESS - issue INT-567: Add round-robin dispatching strategy
http://jira.springframework.org/browse/INT-567 - Renamed LoadBalancingDispatcher to more explicit RoundRobinDispatcher - Removed round-robin option from xsd (not specifying a dispatcher yields the same)
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
package org.springframework.integration.channel;
|
||||
|
||||
import org.springframework.integration.dispatcher.AbstractWinningHandlerDispatcher;
|
||||
import org.springframework.integration.dispatcher.LoadBalancingDispatcher;
|
||||
import org.springframework.integration.dispatcher.RoundRobinDispatcher;
|
||||
|
||||
/**
|
||||
* A channel that invokes a single subscriber for each sent Message.
|
||||
@@ -30,8 +30,9 @@ import org.springframework.integration.dispatcher.LoadBalancingDispatcher;
|
||||
public class DirectChannel extends AbstractSubscribableChannel<AbstractWinningHandlerDispatcher> {
|
||||
|
||||
public DirectChannel() {
|
||||
super(new LoadBalancingDispatcher());
|
||||
super(new RoundRobinDispatcher());
|
||||
}
|
||||
|
||||
public DirectChannel(AbstractWinningHandlerDispatcher dispatcher){
|
||||
super(dispatcher);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
|
||||
private void parseDispatcher(String dispatcherAttribute, BeanDefinitionBuilder builder, ParserContext parserContext) {
|
||||
if (dispatcherAttribute != null) {
|
||||
if (dispatcherAttribute.equals("fail-over")) {
|
||||
if (dispatcherAttribute.equals("failover")) {
|
||||
BeanDefinitionBuilder dispatcherBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(DISPATCHER_PACKAGE + ".FailOverDispatcher");
|
||||
dispatcherBuilder.setRole(BeanDefinition.ROLE_SUPPORT);
|
||||
|
||||
@@ -166,9 +166,19 @@
|
||||
<xsd:attribute name="datatype" type="xsd:string" />
|
||||
<xsd:attribute name="dispatcher">
|
||||
<xsd:simpleType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Defines a dispatching strategy for the channel. The default is a round
|
||||
robin load balancer. In case of a publish subscribe channel this
|
||||
attribute will be ignored.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="fail-over" />
|
||||
<xsd:enumeration value="round-robin" />
|
||||
<xsd:enumeration value="failover" />
|
||||
<!--
|
||||
now the other (default) option is round robin load balancing we
|
||||
can add more options later
|
||||
-->
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*
|
||||
* @author Iwein Fuld
|
||||
*/
|
||||
public class LoadBalancingDispatcher extends AbstractWinningHandlerDispatcher {
|
||||
public class RoundRobinDispatcher extends AbstractWinningHandlerDispatcher {
|
||||
|
||||
private AtomicInteger currentHandlerIndex = new AtomicInteger();
|
||||
|
||||
Reference in New Issue
Block a user