0

I am trying to take an input zip stream and grab the files from inside of it. Currently, I have this bean call attempt to send the stream to a dummy method so I can analyze the body in the debugger. The result is an empty string.

  public void configure() throws Exception {
    from("direct-vm://splitter-route")
        .split(new ZipSplitter())
        .streaming()
        .convertBodyTo(String.class)
        .choice()
        .when(body().isNotNull())
        .bean(this, "testCall")
        .to("file:/tmp/myinputzip")
        .end()
        .end();

How can I get this to pass each individual file to my method?

John Lippson
  • 1,269
  • 5
  • 17
  • 36
  • Your code works perfectly fine for me. Your zip file probably contains files, which cannot be converted to `String`. To see, what is happening and what type is in `body`, comment out line `.convertBodyTo(String.class)` and then check body in `testCall` method with `exchange.getIn().getBody(/*Note there is no casting of body*/)` – Bedla Jul 26 '18 at 17:42
  • My zip contains a single text file that says "hello world" – John Lippson Jul 26 '18 at 17:54
  • As I said, it is working on my machine. I have copied your code, added `from("file://D:\\temp").to("direct-vm://splitter-route");` and files were created without problems. So you are debugging wrong part of application and the problem is in route, which is sending data to `direct-vm`, or you have found bug. Cannot tell without your version. Tested with Camel 2.21.0. – Bedla Jul 26 '18 at 18:03

0 Answers0