Well, we were always intending to support Seam as a container.
We have an interface called ErraiConfigExtension which exposes the bootstrap process. You
can use it to grab access to an ErraiBus instance and, in turn, bootstrap another
container:
/**
* Create a config extension class so we can do things like setup the default tables
* when the application is deployed, etc.
*/
@ExtensionComponent
public class AppConfigurator implements ErraiConfigExtension {
private MessageBus bus;
@Inject
public AppConfigurator(MessageBus bus) {
this.bus = bus;
}
public void configure(Map<Class, Provider> bindings, Map<String, Provider>
resourceProviders) {
// provide extension points here
}
}
The configure() method is called when the component is auto-discovered in the class path.
So you could, in theory, simply expose the Errai container to Seam or JNDI, etc.
Mike.
On 2010-02-01, at 3:19 AM, Sean Flanigan wrote:
How can I obtain a reference to the MessageBus inside my Seam web
application on the server side?
I see that the ServerMessageBusImpl is being injected by Guice in
AbstractErraiServlet, but the injector instance seems to be private. So
even if I use Guice myself, it will be a different injector, and hence a
different singleton scope, right?
It looks like all the ErraiBus examples have server classes annotated
with @Service, and constructors which @Inject the MessageBus. I'm not
sure if I can do exactly that. For the moment, I would like to
construct the objects myself. If I could obtain the right Guice
injector, I could call Injector.injectMembers on the objects which need
the MessageBus.
Hmm. I'm not going to have to re-architect everything, am I? (BTW,
unlike the examples, I'm not implementing MessageCallback on the server,
I just want to send messages on the same bus that my clients are polling.)
So is there some way I can obtain a reference to the Injector or the
ErraiService from "outside"? Or will I have to annotate a class with
@Service? It looks to me as if ErraiServiceConfiguratorImpl wants to
construct the object itself (via Guice), which probably won't work for
Seam components...
Am I going about this all wrong, or what?
Thanks
Sean.
--
Sean Flanigan
Senior Software Engineer
Engineering - Internationalisation
Red Hat
_______________________________________________
errai-users mailing list
errai-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/errai-users