Akka Extension dependencies

45 views
Skip to first unread message

Andrey Kuznetsov

unread,
Nov 1, 2015, 10:46:15 AM11/1/15
to Akka User List
Is there any way of controlling Akka Extensions order?
I found out that Akka loads extension B in parallel with extension A even if extension B follows A in `akka.extensions` config value.

I can explicitly call A.apply from B.apply, but maybe there is (o there SHOULD) be more convenient way for controlling it?

Viktor Klang

unread,
Nov 1, 2015, 1:32:46 PM11/1/15
to Akka User List
Hi Andrey,

Akka doesn't load them in parallel:

private def loadExtensions() {
immutableSeq(settings.config.getStringList("akka.extensions")) foreach { fqcn ⇒
dynamicAccess.getObjectFor[AnyRef](fqcn) recoverWith { case _ ⇒ dynamicAccess.createInstanceFor[AnyRef](fqcn, Nil) } match {
case Success(p: ExtensionIdProvider) ⇒ registerExtension(p.lookup())
case Success(p: ExtensionId[_]) ⇒ registerExtension(p)
case Success(other) ⇒ log.error("[{}] is not an 'ExtensionIdProvider' or 'ExtensionId', skipping...", fqcn)
case Failure(problem) ⇒ log.error(problem, "While trying to load extension [{}], skipping...", fqcn)
}
}
}
However, extensions are loaded on demand so an extension might trigger the loading of another extension or some other piece of logic running on a separate thread could trigger the loading of an extension.


--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Cheers,

Andrey Kuznetsov

unread,
Nov 1, 2015, 3:11:55 PM11/1/15
to Akka User List
I see, thanks. But why such logic should be in a separate thread?

Viktor Klang

unread,
Nov 1, 2015, 3:13:52 PM11/1/15
to Akka User List
On Sun, Nov 1, 2015 at 9:11 PM, Andrey Kuznetsov <fe...@loathing.in> wrote:
I see, thanks. But why such logic should be in a separate thread?

An Actor that is spawned that accesses an Extension, for instance



--
Cheers,

Andrey Kuznetsov

unread,
Nov 1, 2015, 3:24:50 PM11/1/15
to akka...@googlegroups.com
Did I get it right, an actor can't trigger extension loading directly, and it should trigger extension loading in the other thread?
 
--
 
Andrey Kuznetsov
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Viktor Klang

unread,
Nov 1, 2015, 3:34:14 PM11/1/15
to Akka User List
No.

I'm saying that Akka loads the extensions listed in the config sequentially, but extensions can trigger the loading of other extensions, both in the thread loaing the extension, but allso on other threads, for instance if an extension triggers the load of other extensions from within an actor it has spawned or otherwise.
Reply all
Reply to author
Forward
0 new messages