You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by 이듀이 <de...@gmail.com> on 2015/09/09 04:21:39 UTC

I want to use bean from another osgi bundle jar or xml

1) I made costom Trace Formatter



<bean id="traceFormatter"
class="test.camel.core.processor.interceptor.BDDefaultTraceFormatter">
<property name="showBreadCrumb"  value="true" />
<property name="showNode" value="true" />
</bean>



2) when It includ my camle router xml, Custom Tace Formatter  is working
well

<blueprint
        xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
        xmlns:cm="
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
        xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
        xsi:schemaLocation="
        http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.1/blueprint.xsd">


<bean id="traceFormatter"
class="test.camel.core.processor.interceptor.BDDefaultTraceFormatter">
<property name="showBreadCrumb"  value="true" />
<property name="showNode"  value="true" />
</bean>

<camelContext trace="true" xmlns="http://camel.apache.org/schema/blueprint">
<route id = "test_trace_router_0001">
<from uri="timer:simpleTimer?period=60000" />
<setBody>
<simple>Hello from timer at ${header.firedTime}</simple>
</setBody>
<log message="TEST ##########################################"/>
<to uri="mock:result"/>
</route>
</camelContext>

</blueprint>


log
======================================================
Timestamp : 2015-09-09 11:20:49
Exchange Id : ID-dewey94esb-PC-33470-1441765239503-2-2
Route Id : test_trace_router_0001
Previous Node : log[TEST ##########################################]
To Node : mock://result
Trace Info >>> log[TEST ##########################################] -->
mock://result <<<
======================================================



*When I make others camel router xml,  Should I always Copy it in
Router-XML ? *

*I want to use bean from another osgi bundle jar or xml.*

*How  Can I reuse bean **from another osgi bundle jar or xml?*

Re: I want to use bean from another osgi bundle jar or xml

Posted by Achim Nierbeck <bc...@googlemail.com>.
You'll need to "copy" the xml as it's part of your route definition.
The class can be in a "shared" jar, where you export the package of the
bean containing it and importing it in the bundles using this bean.

regards, Achim


2015-09-09 4:21 GMT+02:00 이듀이 <de...@gmail.com>:

> 1) I made costom Trace Formatter
>
>
>
> <bean id="traceFormatter"
> class="test.camel.core.processor.interceptor.BDDefaultTraceFormatter">
> <property name="showBreadCrumb"  value="true" />
> <property name="showNode" value="true" />
> </bean>
>
>
>
> 2) when It includ my camle router xml, Custom Tace Formatter  is working
> well
>
> <blueprint
>         xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:jaxws="http://cxf.apache.org/jaxws"
>         xmlns:cm="
> http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
>         xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
>         xsi:schemaLocation="
>         http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.1/blueprint.xsd">
>
>
> <bean id="traceFormatter"
> class="test.camel.core.processor.interceptor.BDDefaultTraceFormatter">
> <property name="showBreadCrumb"  value="true" />
> <property name="showNode"  value="true" />
> </bean>
>
> <camelContext trace="true" xmlns="http://camel.apache.org/schema/blueprint
> ">
> <route id = "test_trace_router_0001">
> <from uri="timer:simpleTimer?period=60000" />
> <setBody>
> <simple>Hello from timer at ${header.firedTime}</simple>
> </setBody>
> <log message="TEST ##########################################"/>
> <to uri="mock:result"/>
> </route>
> </camelContext>
>
> </blueprint>
>
>
> log
> ======================================================
> Timestamp : 2015-09-09 11:20:49
> Exchange Id : ID-dewey94esb-PC-33470-1441765239503-2-2
> Route Id : test_trace_router_0001
> Previous Node : log[TEST ##########################################]
> To Node : mock://result
> Trace Info >>> log[TEST ##########################################] -->
> mock://result <<<
> ======================================================
>
>
>
> *When I make others camel router xml,  Should I always Copy it in
> Router-XML ? *
>
> *I want to use bean from another osgi bundle jar or xml.*
>
> *How  Can I reuse bean **from another osgi bundle jar or xml?*
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master