You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "raulvk.soa" <ra...@gmail.com> on 2009/04/06 21:40:03 UTC

Injecting DeliveryChannel into a HTTP Marshaller

Hi,

I need to inject a DeliveryChannel into a HTTP Marshaller. The system that
the servicemix-http endpoint invokes requires opening a session prior to the
invocation, and this is done by calling another service first. Once the main
service is invoked, I need to call yet another service to close the session.

Therefore the sequence is the following:

  1. Open Session
  2. Invoke Service
  3. Close Session

As you can see, an "interceptor" pattern is adequate. For that, I am using a
HTTP Marshaller (which extends HttpSoapProviderMarshaler), and since 1 and 3
are exposed on the JBI bus, I need to gain access to a DeliveryChannel to be
able to send them messages. However, to begin with, I am having trouble
injecting a DeliveryChannel into the marshaller.

I have tried using the @Resource annotation, injecting a bean with name
"context" into the marshaller via Spring, injecting the "jbi" bean
initialised in servicemix.xml file, but to no avail.

Any ideas?

Many thanks.
-- 
View this message in context: http://www.nabble.com/Injecting-DeliveryChannel-into-a-HTTP-Marshaller-tp22915726p22915726.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Injecting DeliveryChannel into a HTTP Marshaller

Posted by Gert Vanthienen <ge...@gmail.com>.
Raul,

AFAIK, we don't have anything setup to work with annotations to inject
the necessary resources for a marshaler.  However, the xbean.xml file
is just a Spring XML file essentially, so you should be able to inject
e.g. the jbi container or something in your Marshaler that way.  It's
probably easier to try and inject a ServiceMix client instead, as that
will make it easier for you to interoperate with the other services
(cfr. http://servicemix.apache.org/client-api.html)? You probably need
to refer to #jbi instead of jbi as the bean name though, but other
than that it should work, I guess.

If you can't get it to work, could you post us the xbean.xml contents?
 Another solution could be to pick these things off the incoming
Exchange (which should carry the source component's context to get you
to the container or something).

Another way to look at this is by making it even more SOAish.  You
might be able to model the sequence you described (open session -
invoke service - close session) with one of the EIP patterns (a
Pipeline or Static Routing Slip) or using a Camel route instead, just
invoking the services one after the other instead of hand-coding
things in the Marshaler.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/4/6 raulvk.soa <ra...@gmail.com>:
>
> Hi,
>
> I need to inject a DeliveryChannel into a HTTP Marshaller. The system that
> the servicemix-http endpoint invokes requires opening a session prior to the
> invocation, and this is done by calling another service first. Once the main
> service is invoked, I need to call yet another service to close the session.
>
> Therefore the sequence is the following:
>
>  1. Open Session
>  2. Invoke Service
>  3. Close Session
>
> As you can see, an "interceptor" pattern is adequate. For that, I am using a
> HTTP Marshaller (which extends HttpSoapProviderMarshaler), and since 1 and 3
> are exposed on the JBI bus, I need to gain access to a DeliveryChannel to be
> able to send them messages. However, to begin with, I am having trouble
> injecting a DeliveryChannel into the marshaller.
>
> I have tried using the @Resource annotation, injecting a bean with name
> "context" into the marshaller via Spring, injecting the "jbi" bean
> initialised in servicemix.xml file, but to no avail.
>
> Any ideas?
>
> Many thanks.
> --
> View this message in context: http://www.nabble.com/Injecting-DeliveryChannel-into-a-HTTP-Marshaller-tp22915726p22915726.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>