You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2010/09/15 09:06:40 UTC

[jira] Issue Comment Edited: (CAMEL-3121) Splitter EIP - The sub exchanges should not contains on completions from original Exchange

    [ https://issues.apache.org/activemq/browse/CAMEL-3121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61817#action_61817 ] 

Claus Ibsen edited comment on CAMEL-3121 at 9/15/10 3:06 AM:
-------------------------------------------------------------

Hi Claus,

We are still able to reproduce it with 2.5.0. (both problems)

Did you try it on Windows ?

Issue 1:
{code}
from("file:e:/test/camel").split(body().tokenize(",")).process(new Processor() {
        @Override
        public void process(Exchange arg0) throws Exception {
                Thread.sleep(2000);
        }
}); 
{code}

It looks like the testcase you`ve done for FileSplitStreamingWithChoiceTest.java except you need to remove streaming.
Quick patch: Splitter.java

{code}
private Iterable<ProcessorExchangePair> createProcessorExchangePairsList(
                        Exchange exchange, Object value) {
                List<ProcessorExchangePair> result;
                Integer collectionSize = CollectionHelper.size(value);
                if (collectionSize != null) {
                        result = new ArrayList<ProcessorExchangePair>(collectionSize);
                } else {
                        result = new ArrayList<ProcessorExchangePair>();
                }
                Iterable<ProcessorExchangePair> createProcessorExchangePairsIterable = createProcessorExchangePairsIterable(
                                exchange, value);
                Iterator<ProcessorExchangePair> iterator = createProcessorExchangePairsIterable
                                .iterator();
                while (iterator.hasNext()) {
                        ProcessorExchangePair next = iterator.next();
                        result.add(next);
                }
                return result;
        } 
{code}

Issue 2
Quick Patch:

{code}
public Object next() {
        Object part = iterator.next();
        Exchange newExchange = exchange.copy();
                if (iterator.hasNext()) {
                        newExchange.setUnitOfWork(null);
                        }                        if (part instanceof Message) {
                                                        newExchange.setIn((Message) part);
                                                } else {
                                                        Message in = newExchange.getIn();
                                                        in.setBody(part);
                                                }
                                                return createProcessorExchangePair(index++,
                                                                getProcessors().iterator().next(), newExchange);
                                        }
:
{code}

      was (Author: smcduff@hotmail.com):
    Hi Claus,

We are still able to reproduce it with 2.5.0. (both problems)

Did you try it on Windows ?

Issue 1:
from("file:e:/test/camel").split(body().tokenize(",")).process(new Processor() {
        @Override
        public void process(Exchange arg0) throws Exception {
                Thread.sleep(2000);
        }
}); 
It looks like the testcase you`ve done for FileSplitStreamingWithChoiceTest.java except you need to remove streaming.
Quick patch:
Splitter.java
private Iterable<ProcessorExchangePair> createProcessorExchangePairsList(
                        Exchange exchange, Object value) {
                List<ProcessorExchangePair> result;
                Integer collectionSize = CollectionHelper.size(value);
                if (collectionSize != null) {
                        result = new ArrayList<ProcessorExchangePair>(collectionSize);
                } else {
                        result = new ArrayList<ProcessorExchangePair>();
                }
                Iterable<ProcessorExchangePair> createProcessorExchangePairsIterable = createProcessorExchangePairsIterable(
                                exchange, value);
                Iterator<ProcessorExchangePair> iterator = createProcessorExchangePairsIterable
                                .iterator();
                while (iterator.hasNext()) {
                        ProcessorExchangePair next = iterator.next();
                        result.add(next);
                }
                return result;
        } 


Issue 2

Quick Patch:
public Object next() {
        Object part = iterator.next();
        Exchange newExchange = exchange.copy();
                if (iterator.hasNext()) {
                        newExchange.setUnitOfWork(null);
                        }                        if (part instanceof Message) {
                                                        newExchange.setIn((Message) part);
                                                } else {
                                                        Message in = newExchange.getIn();
                                                        in.setBody(part);
                                                }
                                                return createProcessorExchangePair(index++,
                                                                getProcessors().iterator().next(), newExchange);
                                        }
:
  
> Splitter EIP - The sub exchanges should not contains on completions from original Exchange
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3121
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-3121
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.5.0
>
>
> See nabble
> http://camel.465427.n5.nabble.com/Camel-calling-commit-too-early-when-using-split-seda-file-endpoint-tp2830894p2830894.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.