You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by James Strachan <ja...@gmail.com> on 2006/06/30 20:01:17 UTC

[HeadsUp] changes to the ServiceMixClient API to support simpler access via URIs

I've added support for a Destination interface which makes it easier
to work with destinations (endpoints) in JBI from a client API rather
like working with Destinations in JMS.

You can create a destination from a URI then use it as a factory of
MessageExchange / Message objects to simplify working with JBI.

I've updated the documentation to describe this...
http://servicemix.org/site/client-api.html

(see the section on working with URIs and Destinations).

I've tried my best to make this as simple as possiblie for folks to
use to interact with the NMR though I'm open to suggestions - can
anyone think of any ways to improve this API and make it simpler?

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: [HeadsUp] changes to the ServiceMixClient API to support simpler access via URIs

Posted by James Strachan <ja...@gmail.com>.
On 7/3/06, Renaud Bruyeron <br...@fullsix.com> wrote:
> James Strachan wrote:
> > The ServiceMixClient - if its dependency injected with a JBI container
> > instance -
>
> The doco does not explain how to do this: "inject the JBI container".
> Most of the time I want to use the client I am inside a service unit
> deployed to a component like lwcontainer or http - I do not know how to
> get the reference to the container in the xbean.xml. I can do something
> like ((ComponentContextImpl) getContext()).getContainer() but this is
> ugly and wrong.
>
> What's the best way to go about this?

If you are a component and have access to a component context then
just create a ServiceMixClientFacade which implements the
ServiceMixClient API.

ServiceMixClient client = new ServiceMixClientFacade(context);

I just added this snippet of code to the end of the web page...
http://servicemix.org/site/client-api.html
-- 

James
-------
http://radio.weblogs.com/0112098/

Re: [HeadsUp] changes to the ServiceMixClient API to support simpler access via URIs

Posted by Renaud Bruyeron <br...@fullsix.com>.
James Strachan wrote:
> The ServiceMixClient - if its dependency injected with a JBI container
> instance - 

The doco does not explain how to do this: "inject the JBI container".
Most of the time I want to use the client I am inside a service unit 
deployed to a component like lwcontainer or http - I do not know how to 
get the reference to the container in the xbean.xml. I can do something 
like ((ComponentContextImpl) getContext()).getContainer() but this is 
ugly and wrong.

What's the best way to go about this?

  - Renaud


Re: [HeadsUp] changes to the ServiceMixClient API to support simpler access via URIs

Posted by James Strachan <ja...@gmail.com>.
On 6/30/06, Hossam Karim <hr...@gmail.com> wrote:
> Excellent, Thanks Guillaume and James.
> I have two comments:
> - James, does the client API intentionally allow invoking a service without
> specifying an operation?

So the URI could include the operation name via 'operation:..."

http://incubator.apache.org/servicemix/uris.html

Or maybe we could append an operation name on any URI as a query argument...

service:http://foo.com/bar/whatnot?operation=foo

there's also nothing stopping the user of the ServiceMixClient APIs to
configure the MessageExchange directly in any way. I personally prefer
hiding all those details in the URI so that a Destination is just some
endpoint in a JMS-like way hiding all the various details of the
routing.


> - Guillaume, would it be possible to inject a DeliveryChannel instance into
> the web application context?

The ServiceMixClient - if its dependency injected with a JBI container
instance - has a delivery channel it uses. So I guess the
ServiceMixClient could be dependency injected - say via Spring - or
put inside JNDI so that web apps can invoke arbitrary services in JBI
without itself being a JBI component.

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: [HeadsUp] changes to the ServiceMixClient API to support simpler access via URIs

Posted by Hossam Karim <hr...@gmail.com>.
Excellent, Thanks Guillaume and James.
I have two comments:
- James, does the client API intentionally allow invoking a service without
specifying an operation?
- Guillaume, would it be possible to inject a DeliveryChannel instance into
the web application context?

Hossam Karim


On 6/30/06, Guillaume Nodet <gn...@gmail.com> wrote:
>
> Great !
> I already love Destinations + URIs.  This is a very useful addition.
>
> One thing we might want on the client api is maybe a factory that we could
> bind to JNDI so that you can access this API from anywhere.  I have
> discussed that with Aaron Mulder in Dublin (about ServiceMix integration
> with Geronimo).  We currently lack a simple way for web application to
> access an existing JBI container. We could use gbeans inside Geronimo,
> but this is not portable, so a JNDI factory seems a good fit.
> Does anyone think about a better way ?
>
> Cheers,
> Guillaume Nodet
>
> On 6/30/06, James Strachan <ja...@gmail.com> wrote:
> >
> > I've added support for a Destination interface which makes it easier
> > to work with destinations (endpoints) in JBI from a client API rather
> > like working with Destinations in JMS.
> >
> > You can create a destination from a URI then use it as a factory of
> > MessageExchange / Message objects to simplify working with JBI.
> >
> > I've updated the documentation to describe this...
> > http://servicemix.org/site/client-api.html
> >
> > (see the section on working with URIs and Destinations).
> >
> > I've tried my best to make this as simple as possiblie for folks to
> > use to interact with the NMR though I'm open to suggestions - can
> > anyone think of any ways to improve this API and make it simpler?
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>

Re: [HeadsUp] changes to the ServiceMixClient API to support simpler access via URIs

Posted by Guillaume Nodet <gn...@gmail.com>.
Great !
I already love Destinations + URIs.  This is a very useful addition.

One thing we might want on the client api is maybe a factory that we could
bind to JNDI so that you can access this API from anywhere.  I have
discussed that with Aaron Mulder in Dublin (about ServiceMix integration
with Geronimo).  We currently lack a simple way for web application to
access an existing JBI container. We could use gbeans inside Geronimo,
but this is not portable, so a JNDI factory seems a good fit.
Does anyone think about a better way ?

Cheers,
Guillaume Nodet

On 6/30/06, James Strachan <ja...@gmail.com> wrote:
>
> I've added support for a Destination interface which makes it easier
> to work with destinations (endpoints) in JBI from a client API rather
> like working with Destinations in JMS.
>
> You can create a destination from a URI then use it as a factory of
> MessageExchange / Message objects to simplify working with JBI.
>
> I've updated the documentation to describe this...
> http://servicemix.org/site/client-api.html
>
> (see the section on working with URIs and Destinations).
>
> I've tried my best to make this as simple as possiblie for folks to
> use to interact with the NMR though I'm open to suggestions - can
> anyone think of any ways to improve this API and make it simpler?
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>