Author: boday Date: Wed Jul 18 15:40:14 2012 New Revision: 1362984 URL: http://svn.apache.org/viewvc?rev=1362984&view=rev Log: CAMEL-4327 changed new resequencer rejectOld option to an @XmlAttribute instead of @XmlElement for consistency
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencerRejectOld.xml Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java?rev=1362984&r1=1362983&r2=1362984&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java Wed Jul 18 15:40:14 2012 @@ -42,7 +42,7 @@ public class StreamResequencerConfig ext private Boolean ignoreInvalidExchanges; @XmlTransient private ExpressionResultComparator comparator; - @XmlElement + @XmlAttribute private Boolean rejectOld; /** @@ -56,7 +56,7 @@ public class StreamResequencerConfig ext } /** - * Creates a new {@link BatchResequencerConfig} instance using the given + * Creates a new {@link StreamResequencerConfig} instance using the given * values for <code>capacity</code> and <code>timeout</code>. Elements * of the sequence are compared using the {@link DefaultExchangeComparator}. * @@ -68,7 +68,7 @@ public class StreamResequencerConfig ext } /** - * Creates a new {@link BatchResequencerConfig} instance using the given + * Creates a new {@link StreamResequencerConfig} instance using the given * values for <code>capacity</code> and <code>timeout</code>. Elements * of the sequence are compared with the given * {@link ExpressionResultComparator}. @@ -84,6 +84,36 @@ public class StreamResequencerConfig ext } /** + * Creates a new {@link StreamResequencerConfig} instance using the given + * values for <code>capacity</code> and <code>timeout</code>. Elements + * of the sequence are compared using the {@link DefaultExchangeComparator}. + * + * @param capacity capacity of the resequencer's inbound queue. + * @param timeout minimum time to wait for missing elements (messages). + * @param rejectOld if true, throws an error when messages older than the last delivered message are processed + */ + public StreamResequencerConfig(int capacity, long timeout, Boolean rejectOld) { + this(capacity, timeout, rejectOld, new DefaultExchangeComparator()); + } + + /** + * Creates a new {@link StreamResequencerConfig} instance using the given + * values for <code>capacity</code> and <code>timeout</code>. Elements + * of the sequence are compared with the given {@link ExpressionResultComparator}. + * + * @param capacity capacity of the resequencer's inbound queue. + * @param timeout minimum time to wait for missing elements (messages). + * @param rejectOld if true, throws an error when messages older than the last delivered message are processed + * @param comparator comparator for sequence comparision + */ + public StreamResequencerConfig(int capacity, long timeout, Boolean rejectOld, ExpressionResultComparator comparator) { + this.capacity = capacity; + this.timeout = timeout; + this.rejectOld = rejectOld; + this.comparator = comparator; + } + + /** * Returns a new {@link StreamResequencerConfig} instance using default * values for <code>capacity</code> (1000) and <code>timeout</code> * (1000L). Elements of the sequence are compared using the Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencerRejectOld.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencerRejectOld.xml?rev=1362984&r1=1362983&r2=1362984&view=diff ============================================================================== --- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencerRejectOld.xml (original) +++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencerRejectOld.xml Wed Jul 18 15:40:14 2012 @@ -30,9 +30,7 @@ <to uri="mock:error"/> </onException> <resequence> - <stream-config capacity="3" timeout="1000"> - <rejectOld>true</rejectOld> - </stream-config> + <stream-config capacity="3" timeout="1000" rejectOld="true"/> <header>seqno</header> <to uri="mock:result"/> </resequence>