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

Glen Mazza commented on CAMEL-489:
----------------------------------

If I understand you correctly, CAMEL-84 (whenever it's fixed) will throw an 
exception when it cannot find the correct converter type.  That will allow 
newbies like me to be able to visually see this error from a command-line 
terminal window without first needing to configure logging.  That sounds good.  
If so, this issue can be closed or marked as a duplicate of CAMEL-84.  Also, I 
updated the logging page with your instructions above so others can quickly 
reference it.  Thanks!






> file component can't handle ArrayList Exchange body
> ---------------------------------------------------
>
>                 Key: CAMEL-489
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-489
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Glen Mazza
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> For CXF usage, the exchange body needs to be an array list (or list of 
> strings) to hold the Web service request's parameters.  However file 
> components are failing if that is the datatype of the Exchange message.
> The source file at the bottom runs fine, giving this output:
> i is: 0
> i is: 1
> i is: 2
> This was called - Body: 0
> In file's process
> This was called - Body: 1
> In file's process
> This was called - Body: 2
> In file's process
> However, if I change the one line of code below marked "----->"  with 
> "params" instead of "Hello!", this is the output:
> i is: 0
> This was called - Body: 0
> i is: 1
> i is: 2
> This was called - Body: 1
> This was called - Body: 2
> The "In file's process" never appears, because for some reason the file 
> component cannot handle the fact that the Exchange body is a list array.  It 
> appears that either the Camel code needs to be changed to allow arraylists 
> for file components, or some exception should be raised--it presently just 
> runs quietly, not giving the user the feedback that an invalid body type is 
> given.
> Source file:
> {code}
> package com.mycompany.camel;
> import java.util.ArrayList;
> import java.util.List;
> import javax.jms.ConnectionFactory;
> import org.apache.activemq.ActiveMQConnectionFactory;
> import org.apache.camel.CamelContext;
> import org.apache.camel.CamelTemplate;
> import org.apache.camel.component.cxf.CxfConstants;
> import org.apache.camel.Exchange;
> import org.apache.camel.Processor;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.jms.JmsComponent;
> import org.apache.camel.impl.DefaultCamelContext;
> /**
>  * Hello world!
>  * 
>  */
> public class CamelSample2 {
>    private CamelSample2() {
>    }
>    public static void main(String[] args) {
>       CamelSample2 cs = new CamelSample2();
>       try {
>          cs.run();
>       } catch (Exception e) {
>       }
>    }
>    private void run() throws Exception {
>       CamelContext context = new DefaultCamelContext();
>       
>       ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
>             "vm://localhost?broker.persistent=false");
>       context.addComponent("test-jms", JmsComponent
>             .jmsComponentAutoAcknowledge(connectionFactory));
>       context.addRoutes(new RouteBuilder() {
>          public void configure() {
>             from("test-jms:queue:test.queue").process(new Processor() {
>                public void process(Exchange e) {
>                    System.out.println("This was called - Body: " + 
> e.getIn().getBody(String.class));
>                    final List<String> params = new ArrayList<String>();
>                    params.add(e.getIn().getBody(String.class));
> ---->            e.getOut().setBody("Hello");  // params);
>                  }
>                
>            }).to("file://testfile.txt").process(new Processor() {
>               public void process(Exchange e) {
>                  System.out.println("In file's process");
>                 }
>                });
>            }
>       });
>             
>       CamelTemplate template = new CamelTemplate(context);
>       context.start();
>       for (int i = 0; i < 3; i++) {
>          System.out.println("i is: " + i);
>          template.sendBody("test-jms:queue:test.queue", "" + i);
>       }
>       Thread.sleep(60000 * 3);  
>       context.stop();
>    }
> }
> {code}

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

Reply via email to