You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ishada <ab...@gmail.com> on 2015/11/22 14:09:13 UTC

File name changed when Ziping the files in camel

I am trying to implement a scenario which is as follows. Get all the files
from a location and zip the files and put the zip file to other location. It
is working fine put when I am trying to open the zip file, camel has changed
all the files name to default unique naming convention. I want the files
name not to be modified. I tried in many ways but couldn't achieve it. My
code looks as follows.

from(from).process(new Processor() {
                RouteTerminator terminator;
                @Override
                public void process(Exchange exchange) throws Exception {
                    Object data = exchange.getIn().getHeader(
                            "CamelFileName");
                    logger.info("File Name for Archive Process" + data);
                    if (data == null) {
                        terminator = new RouteTerminator(routeId, exchange
                                .getContext());
                        terminator.start();
                    }
                    exchange.getIn().setHeader("CamelFileName", data);
                }
            }).aggregate(new ZipAggregationStrategy()).constant(true)
            .completionFromBatchConsumer().eagerCheckCompletion()
            .setHeader(Exchange.FILE_NAME, constant(generateFileName()))
            .to(to).process(new Processor() {
                RouteTerminator terminator;

                @Override
                public void process(Exchange exchange) throws Exception {
                    log.debug("RouteTerminator is called from
ServerArchiveFilesRoute to Stop the route");
                    terminator = new RouteTerminator(routeId, exchange
                            .getContext());
                    terminator.start();

                }
            }).routeId(routeId);



--
View this message in context: http://camel.465427.n5.nabble.com/File-name-changed-when-Ziping-the-files-in-camel-tp5774234.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: File name changed when Ziping the files in camel

Posted by Claus Ibsen <cl...@gmail.com>.
Apache Camel is not a zip file tool. What you are doing is not what
Camel was designed for.

You are better of with using perl / bash script or what else is out
there that are much better for these kind of tasks.



On Sun, Nov 22, 2015 at 2:09 PM, Ishada <ab...@gmail.com> wrote:
> I am trying to implement a scenario which is as follows. Get all the files
> from a location and zip the files and put the zip file to other location. It
> is working fine put when I am trying to open the zip file, camel has changed
> all the files name to default unique naming convention. I want the files
> name not to be modified. I tried in many ways but couldn't achieve it. My
> code looks as follows.
>
> from(from).process(new Processor() {
>                 RouteTerminator terminator;
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                     Object data = exchange.getIn().getHeader(
>                             "CamelFileName");
>                     logger.info("File Name for Archive Process" + data);
>                     if (data == null) {
>                         terminator = new RouteTerminator(routeId, exchange
>                                 .getContext());
>                         terminator.start();
>                     }
>                     exchange.getIn().setHeader("CamelFileName", data);
>                 }
>             }).aggregate(new ZipAggregationStrategy()).constant(true)
>             .completionFromBatchConsumer().eagerCheckCompletion()
>             .setHeader(Exchange.FILE_NAME, constant(generateFileName()))
>             .to(to).process(new Processor() {
>                 RouteTerminator terminator;
>
>                 @Override
>                 public void process(Exchange exchange) throws Exception {
>                     log.debug("RouteTerminator is called from
> ServerArchiveFilesRoute to Stop the route");
>                     terminator = new RouteTerminator(routeId, exchange
>                             .getContext());
>                     terminator.start();
>
>                 }
>             }).routeId(routeId);
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/File-name-changed-when-Ziping-the-files-in-camel-tp5774234.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2