You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by lost_in <re...@gmail.com> on 2013/03/25 09:20:28 UTC

in camel-example-cxf-proxy demo which in camel distribution, how EnrichBean.enrich method was called

I am a newbie in camel,when I read the camel-example-cxf-proxy demo which in
camel distribution,
I confuse with EnrichBean.java file

the source code of EnrichBean.java is very simple as follows:

public class EnrichBean {

    public Document enrich(Document doc) {
        Node node = doc.getElementsByTagName("incidentId").item(0);
        String incident = node.getTextContent();

        // here we enrich the document by changing the incident id to
another value
        // you can of course do a lot more in your use-case
        node.setTextContent("456");
        System.out.println("Incident was " + incident + ", changed to 456");

        return doc;
    }
}

it was used in camel_config.xml as follows:

  
  <bean id="enrichBean"
class="org.apache.camel.example.cxf.proxy.EnrichBean"/>
  

  <camelContext xmlns="http://camel.apache.org/schema/spring">
    <endpoint id="callRealWebService"
uri="http://localhost:${real.port}/real-webservice?throwExceptionOnFailure=false"/>
    <route>
      
      <from uri="cxf:bean:reportIncident?dataFormat=MESSAGE"/>
      
      <to uri="log:input"/>
      
      <to uri="bean:enrichBean"/>
      
      <to ref="callRealWebService"/>
      
      <to uri="log:output"/>
    </route>

  </camelContext>

my question is: how EnrichBean.enrich method was called and why the
parameter to enrich() is Document type?

any reply is appriciate!



--
View this message in context: http://camel.465427.n5.nabble.com/in-camel-example-cxf-proxy-demo-which-in-camel-distribution-how-EnrichBean-enrich-method-was-called-tp5729745.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: in camel-example-cxf-proxy demo which in camel distribution, how EnrichBean.enrich method was called

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Welcome to the community.

Next time please use the @user mailing list for these kind of
questions as we say here
http://camel.apache.org/mailing-lists.html

About the bean, then you can read about the bean component, and how it
selects methods, and as well about the bean parameter bindings for
these links:
http://camel.apache.org/bean
http://camel.apache.org/bean-binding.html

And read about the message translator eip pattern
http://camel.apache.org/message-translator.html


On Mon, Mar 25, 2013 at 9:20 AM, lost_in <re...@gmail.com> wrote:
> I am a newbie in camel,when I read the camel-example-cxf-proxy demo which in
> camel distribution,
> I confuse with EnrichBean.java file
>
> the source code of EnrichBean.java is very simple as follows:
>
> public class EnrichBean {
>
>     public Document enrich(Document doc) {
>         Node node = doc.getElementsByTagName("incidentId").item(0);
>         String incident = node.getTextContent();
>
>         // here we enrich the document by changing the incident id to
> another value
>         // you can of course do a lot more in your use-case
>         node.setTextContent("456");
>         System.out.println("Incident was " + incident + ", changed to 456");
>
>         return doc;
>     }
> }
>
> it was used in camel_config.xml as follows:
>
>
>   <bean id="enrichBean"
> class="org.apache.camel.example.cxf.proxy.EnrichBean"/>
>
>
>   <camelContext xmlns="http://camel.apache.org/schema/spring">
>     <endpoint id="callRealWebService"
> uri="http://localhost:${real.port}/real-webservice?throwExceptionOnFailure=false"/>
>     <route>
>
>       <from uri="cxf:bean:reportIncident?dataFormat=MESSAGE"/>
>
>       <to uri="log:input"/>
>
>       <to uri="bean:enrichBean"/>
>
>       <to ref="callRealWebService"/>
>
>       <to uri="log:output"/>
>     </route>
>
>   </camelContext>
>
> my question is: how EnrichBean.enrich method was called and why the
> parameter to enrich() is Document type?
>
> any reply is appriciate!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/in-camel-example-cxf-proxy-demo-which-in-camel-distribution-how-EnrichBean-enrich-method-was-called-tp5729745.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
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