You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "gede06@student.bth.se" <ge...@student.bth.se> on 2006/09/25 14:52:29 UTC

wich archetype to use for MessageExchangeListener?

Hello all,

I want to create a Listener implementing
http://servicemix.org/maven/servicemix-core/apidocs/org/apache/servicemix/jbi/event/ExchangeListener.html
and at the end working in a similar way to
http://servicemix.goopen.org/site/visualisation.html I would like to deploy
it using a ServiceAssembly, so it can be switched on/off at runtime -- and
I'm learning how to use SUs/SAs.

I figured out that I need 1st a component or the like (? ist a component the
best for my purpose?) which will be 2) packed in a ServiceUnit which 3) will
be placed in a ServiceAssembly. I want to use the tooling and had a look at
http://www.servicemix.org/site/creating-a-standard-jbi-component.html but
have absolutely no idea which archetype(s) to use. Any suggestions?

Thanks in advance, Georg
-- 
View this message in context: http://www.nabble.com/wich-archetype-to-use-for-MessageExchangeListener--tf2331382.html#a6485794
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: wich archetype to use for MessageExchangeListener?

Posted by "gede06@student.bth.se" <ge...@student.bth.se>.

gnodet wrote:
> 
> The best way would be to create a lightweight
> component for the lw-container.  At initialization time, you can cast
> the ComponentContext to its implementation and retrieve the
> JBI container.  Then, you just need to register your listener on it.
> 

Thanks for pointing out, I will have a closer look at this approach :-)
Georg
-- 
View this message in context: http://www.nabble.com/wich-archetype-to-use-for-MessageExchangeListener--tf2331382.html#a6486745
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: wich archetype to use for MessageExchangeListener?

Posted by Guillaume Nodet <gn...@gmail.com>.
If you want to configure a ExchangeListener at runtime (which is not
the same as a MessageExchangeListener ...), you will need to
hack a bit.
To register an event listener on the container, you will need to access
the JbiContainer class.  The best way would be to create a lightweight
component for the lw-container.  At initialization time, you can cast
the ComponentContext to its implementation and retrieve the
JBI container.  Then, you just need to register your listener on it.

THis component could be something like the following
public class EventListenerComponent extends ComponentSupport {
  private final EventListener listener;
  // getter + setter
  public void start() {
    JBIContainer jbi = ((ComponentContextImpl) getContext()).getContainer();
    jbi.addListener(listener);
    super.start();
  }
  public void stop() {
    super.stop();
    JBIContainer jbi = ((ComponentContextImpl) getContext()).getContainer();
    jbi.removeListener(listener);
  }
}

This component can be reusable, to feel free to raise a JIRA and
attach a patch.

On 9/25/06, gede06@student.bth.se <ge...@student.bth.se> wrote:
>
> Hello all,
>
> I want to create a Listener implementing
> http://servicemix.org/maven/servicemix-core/apidocs/org/apache/servicemix/jbi/event/ExchangeListener.html
> and at the end working in a similar way to
> http://servicemix.goopen.org/site/visualisation.html I would like to deploy
> it using a ServiceAssembly, so it can be switched on/off at runtime -- and
> I'm learning how to use SUs/SAs.
>
> I figured out that I need 1st a component or the like (? ist a component the
> best for my purpose?) which will be 2) packed in a ServiceUnit which 3) will
> be placed in a ServiceAssembly. I want to use the tooling and had a look at
> http://www.servicemix.org/site/creating-a-standard-jbi-component.html but
> have absolutely no idea which archetype(s) to use. Any suggestions?
>
> Thanks in advance, Georg
> --
> View this message in context: http://www.nabble.com/wich-archetype-to-use-for-MessageExchangeListener--tf2331382.html#a6485794
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet