...
Info | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||
|
Accessing the JBI bus
The prefered way to access the JBI bus is by retrieving a ComponentContext implementation.
The spring BeanFactory has a parent factory which contains a bean named "context" that you can refer to.
Code Block | ||
---|---|---|
| ||
<jsr181:endpoint ...>
<jsr181:pojo>
<bean class="xxx">
<property name="context" ref="context" />
</bean>
</jsr181:pojo>
</jsr181:endpoint>
|
If you want to send a request to another service from your POJO, you can add the following method on your POJO:
...
You can create java proxies for JBI endpoints, provided that they expose a WSDL.
The basic configuration is the following:
Wiki Markup |
---|
{snippet:id=proxy|lang=xml|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/org/apache/servicemix/jsr181/spring.xml} |
You can use it from one of you client bean, or from inside another component, and call the JBI endpoint as a plain Java object.
From a jsr181 Service Unit, it could be used as following:
Wiki Markup |
---|
{snippet:id=proxy|lang=xml|url=http://svn.apache.org/repos/asf/incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/proxy/xbean.xml} |
Code Block | ||
---|---|---|
| ||
private Echo echo; public void setEcho(Echo echo) { this.echo = echo; } public void myMethod() { String result = echo.echo("world"); ... } |
...