activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Reload Java EIP Rules
Date Thu, 06 Dec 2007 17:50:32 GMT
On 20/11/2007, James Strachan <james.strachan@gmail.com> wrote:
> On 20/11/2007, James Strachan <james.strachan@gmail.com> wrote:
> > On 20/11/2007, Rob Davies <rajdavies@gmail.com> wrote:
> > > ActiveMQ 5 requires Java 5 - so this won't be a problem for AgentSmth
> > > We just need to override the Smith.redefineClass() method in a
> > > derived class to add some eventing to stop the routes and reload the
> > > classes
> >
> > That should work! :)
> >
> > If it doesn't - or we hit some limitation of AgentSmith (e.g. I've
> > seen talk of AgentSmith not reloading stuff if you add new methods or
> > fields to a class), I guess we could always build our own little
> > reloading classloader thingy?
> >
> > e.g. we could do something like this in camel...
> >
> > <camelContext>
> >   <rules dir="lib/rules" package="org.foo"/>
> > </camelContext>
> >
> > which would then create a single ClassLoader for all the *.jar files
> > in that directory and then load and activate all the rules in there.
> >
> > If any of the jars change, we could stop all those rules, ditch the
> > classloader and reload all the jars again and re-activate the rules
> > again.
> >
> > I guess AgentSmith might be more clever and realise just which rules
> > have actually changed maybe? I wonder if eclipse has any clever
> > hot-swap ninja we could reuse?
>
> I was chatting with Guillaume on IRC and he mentioned this lovely
> looking tool...
> http://www.aqute.biz/Code/FileInstall
>
> which can monitor a directory for OSGi bundles (jars really) and
> install+start then stop+uninstall & reload things if the jars change.
>
> So I guess one neat solution could be to allow ActiveMQ to boot up an
> OSGi container (say Felix) with spring+osgi and FileInstall installed.
> Then if Java routing rules were put into OSGi bundles (i.e. a jar with
> the OSGi metadata), spring-osgi should auto-boot up the bundle and
> activate the routing rules when the jar loads - and stop the routing
> rules when the bundle is stopped & uninstalled.
>
> It'd be nice if we could get the FileInstall to also allow any
> spring.xml to be added to the deploy directory & for it to be
> reloaded; then folks could just drop in routing rules as spring.xml
> files; or edit them to have things reload. i.e. kinda treating any
> spring.xml file as a kinda bundle with no Java code :)

Just to tie up the loose ends here - the ServiceMix 4 Runtime is
coming together nicely!

It supports the hot-redeployment of OSGi bundles; so Camel routes get
auto-redeployed. Plus there's an expanded OSGi bundle format; so you
can edit a Spring XML or change a Java class inside a bundle (via just
editing the files directly) and the runtime will auto-reload the OSGi
bundle giving fast reload of any Camel routing rules.
http://cwiki.apache.org/SMX4/runtime.html

So the only thing we need is to convert the ActiveMQ broker itself to
use the ServiceMix 4 Runtime to deploy/run itself and we're good to
go.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message