Hi, I am trying to modify the contents of a file using a Camel processor in a
Camel component that I created. 
When I do the routing from one file to another using my component, it works. 
However, when trying to modify the contents of the file using the processor
and putting the modified text in the second file, it doesn't work, it says
the contents are null. See the code below: 

public class ComponentStub extends DefaultComponent {
            public Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
                          FileComponent fileComp = new FileComponent();
                          fileComp.setCamelContext(this.getCamelContext());     
              
                          Collection<Endpoint> endpointCol =
fileComp.getCamelContext().getEndpoints();
                          Iterator endpointIt = endpointCol.iterator(); 
endpointIt.next();
endpointIt.next(); endpointIt.next();
                          Endpoint e4 = (Endpoint)endpointIt.next();
                
                         Exchange inExchange = e4.createExchange();
                         final Processor myProcessor = new Processor() {
                             public void process(Exchange exchange) throws 
Exception {
                                     String body = (String) 
exchange.getIn().getBody();
                                     System.out.println(exchange);
                                    
System.out.println(exchange.getFromEndpoint());
                             }
                        }
                        myProcessor.process(inExchange);
                        
                       FileEndpoint outEndPt = (FileEndpoint)
fileComp.createEndpoint(uri);
                       return outEndPt;
        }
}

Output: Exchange[Message: [Body is null]]
           
Endpoint[file:///home/tnedelescu/workspace/CurrentMavenProject/src/alogatr/src/data/input/Component?noop=true]




--
View this message in context: 
http://camel.465427.n5.nabble.com/choice-when-check-BodyType-null-Body-null-tp4259599p4683052.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to