In the previous sample, we have seen how to bind a POJO to JBI and access the service again using the standard web service access mechanisms. Occasionally, your components may also want to access the JBI bus directly at programming API-level, and we can do that using the numerous APIs provided by ServiceMix and JBI.
The preferred mechanism to access JBI from your component is to first get the ComponentContext
implementation and from there traverse the other JBI APIs.
<jsr181:endpoint annotations="none" service="some:Service" serviceInterface="some.Interface"> <jsr181:pojo> <bean class="some.Pojo"> <property name="context" ref="context" /> </bean> </jsr181:pojo> </jsr181:endpoint>
Correspondingly, we will now have our Pojo
(Oh, yes; our POJOs are getting bulkier here!) class into which the JBI container can inject a reference of the ComponentContext
. The pojo
class is reproduced in the following code:
public class Pojo { private...