possible to use multiple Camelcontexts with akka-camel ?

68 views
Skip to first unread message

Andreas Stiller

unread,
Oct 6, 2011, 10:04:22 AM10/6/11
to Akka User List
I am using spring (3.0.6) + camel 2.8 + akka-camel 1.2. My spring
configuration is using several spring-contexts each pointing to a
common parent. The reason is, that the application data is partioned
geographically. So i have one spring-context for each geographic
region (or franchise). These child contexts differes only in region
specific beans (like datasources).

Similarily in wanted to start regional camel-contexts and use akka-
camel Actors for the routing. The problem now is the
CamelServiceManager which only allows one CamelContext concurrently:

java.lang.IllegalStateException: current CamelService already
registered
at akka.camel.CamelServiceManager$.register(CamelService.scala:246)

Is there a way around this so that i can use several CamelServices in
parallel ?

Martin Krasser

unread,
Oct 6, 2011, 10:59:17 AM10/6/11
to akka...@googlegroups.com
No, currently only one (per classloader). The reason is that Akka's
actor registry is a singleton as well (to which the CamelContext is
connected via a registry listener). If this wasn't the case it would
make sense to support more than CamelContext instance. Alternatively,
use OSGi (i.e. different classloaders) for modularization.

Am 06.10.11 16:04, schrieb Andreas Stiller:

--
Martin Krasser

blog: http://krasserm.blogspot.com
code: http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

√iktor Ҡlang

unread,
Oct 6, 2011, 11:03:35 AM10/6/11
to akka...@googlegroups.com
On Thu, Oct 6, 2011 at 4:59 PM, Martin Krasser <kras...@googlemail.com> wrote:
No, currently only one (per classloader). The reason is that Akka's actor registry is a singleton as well (to which the CamelContext is connected via a registry listener). If this wasn't the case it would make sense to support more than CamelContext instance. Alternatively, use OSGi (i.e. different classloaders) for modularization.

Interestingly enough we're currently working on fixing this. (So you can have N number of Akka applications in the same classloader)


Cheers,

 

Am 06.10.11 16:04, schrieb Andreas Stiller:

I am using spring (3.0.6) + camel 2.8 + akka-camel 1.2. My spring
configuration is using several spring-contexts each pointing to a
common parent. The reason is, that the application data is partioned
geographically. So i have one spring-context for each geographic
region (or franchise). These child contexts differes only in region
specific beans (like datasources).

Similarily in wanted to start regional camel-contexts and use akka-
camel Actors for the routing. The problem now is the
CamelServiceManager which only allows one CamelContext concurrently:

java.lang.IllegalStateException: current CamelService already
registered
       at akka.camel.CamelServiceManager$.register(CamelService.scala:246)

Is there a way around this so that i can use several CamelServices in
parallel ?


--
Martin Krasser

blog:    http://krasserm.blogspot.com
code:    http://github.com/krasserm
twitter: http://twitter.com/mrt1nz


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Viktor Klang

Akka Tech Lead
Typesafe - Enterprise-Grade Scala from the Experts

Twitter: @viktorklang

Sean W

unread,
Oct 6, 2011, 3:29:55 PM10/6/11
to Akka User List
Awesome :)

On Oct 6, 11:03 am, √iktor Ҡlang <viktor.kl...@gmail.com> wrote:
> On Thu, Oct 6, 2011 at 4:59 PM, Martin Krasser <krass...@googlemail.com>wrote:
>
> > No, currently only one (per classloader). The reason is that Akka's actor
> > registry is a singleton as well (to which the CamelContext is connected via
> > a registry listener). If this wasn't the case it would make sense to support
> > more than CamelContext instance. Alternatively, use OSGi (i.e. different
> > classloaders) for modularization.
>
> Interestingly enough we're currently working on fixing this. (So you can
> have N number of Akka applications in the same classloader)
>
> Cheers,
> √
>
>
>
>
>
>
>
>
>
>
>
> > Am 06.10.11 16:04, schrieb Andreas Stiller:
>
> >  I am using spring (3.0.6) + camel 2.8 + akka-camel 1.2. My spring
> >> configuration is using several spring-contexts each pointing to a
> >> common parent. The reason is, that the application data is partioned
> >> geographically. So i have one spring-context for each geographic
> >> region (or franchise). These child contexts differes only in region
> >> specific beans (like datasources).
>
> >> Similarily in wanted to start regional camel-contexts and use akka-
> >> camel Actors for the routing. The problem now is the
> >> CamelServiceManager which only allows one CamelContext concurrently:
>
> >> java.lang.**IllegalStateException: current CamelService already
> >> registered
> >>        at akka.camel.**CamelServiceManager$.register(**
> >> CamelService.scala:246)
>
> >> Is there a way around this so that i can use several CamelServices in
> >> parallel ?
>
> > --
> > Martin Krasser
>
> > blog:    http://krasserm.blogspot.com
> > code:    http://github.com/krasserm
> > twitter:http://twitter.com/mrt1nz
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Akka User List" group.
> > To post to this group, send email to akka...@googlegroups.com.
> > To unsubscribe from this group, send email to akka-user+unsubscribe@**
> > googlegroups.com <akka-user%2Bunsu...@googlegroups.com>.
> > For more options, visit this group athttp://groups.google.com/**
> > group/akka-user?hl=en <http://groups.google.com/group/akka-user?hl=en>.
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe <http://www.typesafe.com/> - Enterprise-Grade Scala from the
> Experts
>
> Twitter: @viktorklang

√iktor Ҡlang

unread,
Oct 6, 2011, 5:03:26 PM10/6/11
to akka...@googlegroups.com

Indeed, but it will also mean some major structural changes.

> To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
>
Reply all
Reply to author
Forward
0 new messages