replaced POJOs with expressions for odd/even routing demos
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2010 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.
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2009 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.samples.oddeven;
|
||||
|
||||
/**
|
||||
* A POJO Content Based Router.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class ParityResolver {
|
||||
|
||||
public String getParity(int i) {
|
||||
return (i % 2 == 0) ? "even" : "odd";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2009 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.samples.oddeven;
|
||||
|
||||
/**
|
||||
* A POJO Message Filter.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
public class PositiveChecker {
|
||||
|
||||
public boolean isPositive(int i) {
|
||||
return i > 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,21 +19,17 @@
|
||||
</inbound-channel-adapter>
|
||||
|
||||
<filter input-channel="numbers" output-channel="positives"
|
||||
ref="positiveChecker" method="isPositive"
|
||||
expression="payload > 0"
|
||||
discard-channel="nullChannel"/>
|
||||
|
||||
<router ref="parityResolver" method="getParity" input-channel="positives"/>
|
||||
<router input-channel="positives" expression="payload % 2 == 0 ? 'even' : 'odd'"/>
|
||||
|
||||
<service-activator ref="oddLogger" input-channel="odd"/>
|
||||
<service-activator input-channel="odd" ref="oddLogger"/>
|
||||
|
||||
<service-activator ref="evenLogger" input-channel="even"/>
|
||||
<service-activator input-channel="even" ref="evenLogger"/>
|
||||
|
||||
<beans:bean id="counter" class="org.springframework.integration.samples.oddeven.Counter"/>
|
||||
|
||||
<beans:bean id="positiveChecker" class="org.springframework.integration.samples.oddeven.PositiveChecker"/>
|
||||
|
||||
<beans:bean id="parityResolver" class="org.springframework.integration.samples.oddeven.ParityResolver"/>
|
||||
|
||||
<beans:bean id="oddLogger" class="org.springframework.integration.samples.oddeven.OddLogger"/>
|
||||
|
||||
<beans:bean id="evenLogger" class="org.springframework.integration.samples.oddeven.EvenLogger"/>
|
||||
|
||||
@@ -19,21 +19,17 @@
|
||||
</inbound-channel-adapter>
|
||||
|
||||
<filter input-channel="numbers" output-channel="positives"
|
||||
ref="positiveChecker" method="isPositive"
|
||||
expression="payload > 0"
|
||||
discard-channel="nullChannel"/>
|
||||
|
||||
<router ref="parityResolver" method="getParity" input-channel="positives"/>
|
||||
<router input-channel="positives" expression="payload % 2 == 0 ? 'even' : 'odd'"/>
|
||||
|
||||
<service-activator ref="oddLogger" input-channel="odd"/>
|
||||
<service-activator input-channel="odd" ref="oddLogger"/>
|
||||
|
||||
<service-activator ref="evenLogger" input-channel="even"/>
|
||||
<service-activator input-channel="even" ref="evenLogger"/>
|
||||
|
||||
<beans:bean id="counter" class="org.springframework.integration.samples.oddeven.Counter"/>
|
||||
|
||||
<beans:bean id="positiveChecker" class="org.springframework.integration.samples.oddeven.PositiveChecker"/>
|
||||
|
||||
<beans:bean id="parityResolver" class="org.springframework.integration.samples.oddeven.ParityResolver"/>
|
||||
|
||||
<beans:bean id="oddLogger" class="org.springframework.integration.samples.oddeven.OddLogger"/>
|
||||
|
||||
<beans:bean id="evenLogger" class="org.springframework.integration.samples.oddeven.EvenLogger"/>
|
||||
|
||||
Reference in New Issue
Block a user