You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Gonzalo Vasquez <gv...@altiuz.cl> on 2012/11/16 14:17:08 UTC

Custom File Component

Well, finally I got started on developing a custom File Component for my "fast writing" needs. 

Most of it is working, but I seem to have something wrong as the all exchanges arrive with CamelSplitComplete=true and CamelSplitIndex=0. I'm using the first to know when to close the OutputStream and the Index to know when to open it, but changed this last part to looking in the exchange properties as a workaround, but doesn't work either. 

I supposed that the exchange was stateful, perhaps as an http session, but seems to me that it's a one time only object, similar to an http request object. That would make sense why I'm losing the "fos" property that I store on the exchange. Assuming the later, where in java code should I create the FileOutputStream to keep it useful from exchange to exchange? i.e. different process method invocations (Producer)


What am I missing?

Attached are the java files I wrote and the spring config file with the routes

Thanks!

Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (R&D)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes
(56-2) 335 2461
gvasquez@altiuz.cl
http://www.altiuz.cl
 



Re: Custom File Component

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 16, 2012 at 2:17 PM, Gonzalo Vasquez <gv...@altiuz.cl> wrote:
> Well, finally I got started on developing a custom File Component for my
> "fast writing" needs.
>
> Most of it is working, but I seem to have something wrong as the all
> exchanges arrive with CamelSplitComplete=true and CamelSplitIndex=0. I'm
> using the first to know when to close the OutputStream and the Index to know
> when to open it, but changed this last part to looking in the exchange
> properties as a workaround, but doesn't work either.
>

If you use an custom expression for the splitter, and that implements
Closable, then Camel will invoke that method for you when the splitter
is done. Then you don't need to remember yourself.


> I supposed that the exchange was stateful, perhaps as an http session, but
> seems to me that it's a one time only object, similar to an http request
> object. That would make sense why I'm losing the "fos" property that I store
> on the exchange. Assuming the later, where in java code should I create the
> FileOutputStream to keep it useful from exchange to exchange? i.e. different
> process method invocations (Producer)
>
>
> What am I missing?
>
> Attached are the java files I wrote and the spring config file with the
> routes
>
> Thanks!
>
> Gonzalo Vásquez Sáez
> Gerente Investigación y Desarrollo (R&D)
> Altiuz Soluciones Tecnológicas de Negocios Ltda.
> Av. Nueva Tajamar 555 Of. 802, Las Condes
> (56-2) 335 2461
> gvasquez@altiuz.cl
> http://www.altiuz.cl
>
>
>
>
>
>
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen