You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Timothy High <ti...@sknt.com> on 2006/07/22 00:09:04 UTC

Basic question regarding the JBI Client

Hi all,

 

I'm new to JBI and ServiceMix, and I seem to be missing a basic point here. I can see how JBI can be used to wrap an application in a Service Engine, and can therefore be used to flexibly provide multiple means of transport for the same service interface. This can even be achieved in a non-intrusive way by writing a Service Engine which merely delegates all requests to pure Java methods in the application. What escapes me, however, is how that same application can initiate JBI-style message exchanges (as a client) when the application itself is not service engine component.

 

I see that if your class is a component, the task becomes easy: just call one of the create*Exchange() methods. However, most classes are not JBI components. They could delegate the action to a JBI component, but how do they get a hold of one? They're not on the JNDI context, there's no static/global context (as far as I know), and if they try to instantiate their own component, it won't have access to the JBIContainer.

 

I have also seen that ServiceMix provides some JBI Client implementations (DefaultServiceMixClient, RemoteServiceMixClient). However, the default client needs the JBIContainer, and the remote client asks for a URI - this doesn't seem very efficient if they are running in the same JVM. I just noticed that the remote client uses "peer://org.apache.servicemix?persistent=false" by default. Is this what I need?

 

Thanks in advance!

Tim.

----------------------------------------------------------

Timothy High

Software Engineering

timothy.high@sknt.com <ma...@sknt.com> 

 

Sakonnet Technology 
Centro Empresarial Mourisco 
Praia de Botafogo 501 1°Andar 
Bloco A - Torre Pão de Açúcar 
22250-040  - Rio de Janeiro, RJ Brazil 
www.sknt.com <http://www.sknt.com/> 

+55 (21) 2586 6102  direct 
+55 (21) 2586 6001  fax 

 


Re: Basic question regarding the JBI Client

Posted by Guillaume Nodet <gn...@gmail.com>.
Accessing the JBI bus can be done in several ways, but it mainly depends on
where you are and how you use ServiceMix.
If you are in another JVM, you can use a binding component (jms, http, ...),
a RemoteServiceMixClient, or you a clustered configuration
(which the remote client already does implicitely).
If you are in the same JVM and you use ServiceMix as a standalone server,
you will be inside a JBI component and you should be able
to retrieve the JBIContainer or ComponentContext to create a client (for
example in the jsr181 component).  If you are embedding ServiceMix,
you can retrieve it from the spring configuration.

I know that we need a better way to deal with that and using a JNDI factory
to create clients should be a simple way to do that.
This would be usefull for all kind of integrations, from a standalone
ServiceMix to J2EE containers (Geronimo, JBoss, tomcat, etc...).
I have just raised a JIRA for that:
http://issues.apache.org/activemq/browse/SM-495

Cheers,
Guillaume Nodet

On 7/22/06, Timothy High <ti...@sknt.com> wrote:
>
> Hi all,
>
>
>
> I'm new to JBI and ServiceMix, and I seem to be missing a basic point
> here. I can see how JBI can be used to wrap an application in a Service
> Engine, and can therefore be used to flexibly provide multiple means of
> transport for the same service interface. This can even be achieved in a
> non-intrusive way by writing a Service Engine which merely delegates all
> requests to pure Java methods in the application. What escapes me, however,
> is how that same application can initiate JBI-style message exchanges (as a
> client) when the application itself is not service engine component.
>
>
>
> I see that if your class is a component, the task becomes easy: just call
> one of the create*Exchange() methods. However, most classes are not JBI
> components. They could delegate the action to a JBI component, but how do
> they get a hold of one? They're not on the JNDI context, there's no
> static/global context (as far as I know), and if they try to instantiate
> their own component, it won't have access to the JBIContainer.
>
>
>
> I have also seen that ServiceMix provides some JBI Client implementations
> (DefaultServiceMixClient, RemoteServiceMixClient). However, the default
> client needs the JBIContainer, and the remote client asks for a URI - this
> doesn't seem very efficient if they are running in the same JVM. I just
> noticed that the remote client uses
> "peer://org.apache.servicemix?persistent=false" by default. Is this what I
> need?
>
>
>
> Thanks in advance!
>
> Tim.
>
> ----------------------------------------------------------
>
> Timothy High
>
> Software Engineering
>
> timothy.high@sknt.com <ma...@sknt.com>
>
>
>
> Sakonnet Technology
> Centro Empresarial Mourisco
> Praia de Botafogo 501 1°Andar
> Bloco A - Torre Pão de Açúcar
> 22250-040  - Rio de Janeiro, RJ Brazil
> www.sknt.com <http://www.sknt.com/>
>
> +55 (21) 2586 6102  direct
> +55 (21) 2586 6001  fax
>
>
>
>
>