You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by emmanuel <et...@bouyguestelecom.fr> on 2013/05/22 11:13:08 UTC

files disappeared between 2 routes

Hello,

I have a problem (used camel version: 2.8.4) between 2 routes :

I used a process java bean in a splitter : I have one big file on entry
(around 2GB), make some processes on file and create 2 files with the
splitter on exit.

At the end of the splitter I have to push the files on file endpoint.

But, between my splitter and the file endpoint my files disappeared and
there is no errors on logs...

Any idea ?

To solve the problem, I've added a choice process to push the new files
(with the new name) but it's not a right way for me...


My code then :

<camel:route id="ROUTE_OUT_DATALAB_ACTE_SPLIT">
<camel:from ref="EP_OUT_DATALAB_ACTE_SPLIT" />
<camel:threads>
<camel:choice>
<camel:when>
	<camel:simple>${file:onlyname} regex
'^REFCLIENT_ACTE_EXTRACT_ACTE_.*$'</camel:simple>
	<camel:process ref="EP_OUT_DATALAB_ACTE_TRAITEMENT_PROCESSOR" />
	<camel:split>
		<camel:method bean="EP_OUT_DATALAB_ACTE_SPLITTER_PROCESSOR"/>
		<camel:to ref="EP_OUT_DATALAB_ACTE_TRANSFERT" />
	</camel:split>
</camel:when>
<camel:when>
        <camel:simple>${file:onlyname} regex
'^Extract_COL_.*$'</camel:simple>
	<camel:to ref="EP_OUT_DATALAB_ACTE_TRANSFERT" />
</camel:when>
<camel:otherwise>
         <camel:rollback message = "Traitement DATALAB_ACTE : pas de regle
trouvee pour le fichier"/>
</camel:otherwise>
</camel:choice>
</camel:threads>
</camel:route>

and :

<camel:endpoint id="EP_OUT_DATALAB_ACTE_TRANSFERT"
	
uri="file:///${DATA_PATH}/MDF/OUT/DATALAB/ACTE/TRANSFERT?filter=#EP_OUT_DATALAB_ACTE_TRANSFERT_FILTRE"
/>


Thank you!



--
View this message in context: http://camel.465427.n5.nabble.com/files-disappeared-between-2-routes-tp5732950.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: files disappeared between 2 routes

Posted by emmanuel <et...@bouyguestelecom.fr>.
At the end of my java bean process I set my exchange body to :

exchange.getIn().setBody(files, ArrayList.class);

and just after use this part of code call my splitter processor bean :

@Handler
    public List<Message> splitMessage(@Header(value = Exchange.FILE_NAME)
String header, @Body List<File> bodies) {
        // we can leverage the Parameter Binding Annotations  
        // http://camel.apache.org/parameter-binding-annotations.html
        // to access the message header and body at same time, 
        // then create the message that we want, splitter will
        // take care rest of them.
        // *NOTE* this feature requires Camel version >= 1.6.1
        List<Message> answer = new ArrayList<Message>();

        if (bodies != null && !bodies.isEmpty()) {
            for (File body : bodies) {
                if (body.exists()) {
                    DefaultMessage message = new DefaultMessage();

                    message.setBody(body, File.class);
                    message.setHeader(Exchange.FILE_NAME, body.getName());

                    answer.add(message);
                }
            }

        }
        return answer;
    }

and it works fine. 

When the split process is finished there is my <camel:to
ref="EP_OUT_DATALAB_ACTE_TRANSFERT" /> 

But between my split folder and  outgoing folder referenced by the endpoint
EP_OUT_DATALAB_ACTE_TRANSFERT, the splitted files have disappeared.



--
View this message in context: http://camel.465427.n5.nabble.com/files-disappeared-between-2-routes-tp5732950p5732964.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: files disappeared between 2 routes

Posted by Christian Posta <ch...@gmail.com>.
splitter will aggregate results by default:

see the section "what splitter returns" at this wiki..
http://camel.apache.org/splitter.html

could this be what you're seeing?


On Wed, May 22, 2013 at 2:13 AM, emmanuel <et...@bouyguestelecom.fr>wrote:

> Hello,
>
> I have a problem (used camel version: 2.8.4) between 2 routes :
>
> I used a process java bean in a splitter : I have one big file on entry
> (around 2GB), make some processes on file and create 2 files with the
> splitter on exit.
>
> At the end of the splitter I have to push the files on file endpoint.
>
> But, between my splitter and the file endpoint my files disappeared and
> there is no errors on logs...
>
> Any idea ?
>
> To solve the problem, I've added a choice process to push the new files
> (with the new name) but it's not a right way for me...
>
>
> My code then :
>
> <camel:route id="ROUTE_OUT_DATALAB_ACTE_SPLIT">
> <camel:from ref="EP_OUT_DATALAB_ACTE_SPLIT" />
> <camel:threads>
> <camel:choice>
> <camel:when>
>         <camel:simple>${file:onlyname} regex
> '^REFCLIENT_ACTE_EXTRACT_ACTE_.*$'</camel:simple>
>         <camel:process ref="EP_OUT_DATALAB_ACTE_TRAITEMENT_PROCESSOR" />
>         <camel:split>
>                 <camel:method
> bean="EP_OUT_DATALAB_ACTE_SPLITTER_PROCESSOR"/>
>                 <camel:to ref="EP_OUT_DATALAB_ACTE_TRANSFERT" />
>         </camel:split>
> </camel:when>
> <camel:when>
>         <camel:simple>${file:onlyname} regex
> '^Extract_COL_.*$'</camel:simple>
>         <camel:to ref="EP_OUT_DATALAB_ACTE_TRANSFERT" />
> </camel:when>
> <camel:otherwise>
>          <camel:rollback message = "Traitement DATALAB_ACTE : pas de regle
> trouvee pour le fichier"/>
> </camel:otherwise>
> </camel:choice>
> </camel:threads>
> </camel:route>
>
> and :
>
> <camel:endpoint id="EP_OUT_DATALAB_ACTE_TRANSFERT"
>
>
> uri="file:///${DATA_PATH}/MDF/OUT/DATALAB/ACTE/TRANSFERT?filter=#EP_OUT_DATALAB_ACTE_TRANSFERT_FILTRE"
> />
>
>
> Thank you!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/files-disappeared-between-2-routes-tp5732950.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta