Adding ServletContext Attributes during initialization of the Default Broadcaster Factory

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding ServletContext Attributes during initialization of the Default Broadcaster Factory

ghillert
Hi Jeanfrancois,

I am working on a deeper integration between Atmosphere and Spring and I discovered the need for various use-cases, to make Broadcasters available (and the logic around to manage potentially multiple broadcasters) within the core Spring Application context. In this regard I hit the typically issues regarding Servlet versus Application context initialization.

The CometD folks have a good write-up about the issues here:

http://cometd.org/documentation/cometd-java/server/services/integration-spring

For the time being, I am favoring the "Late Spring Initialization" option and thus making sure that the Atmosphere Servlet is loaded first, before Spring boots up. *

Here is my question/request: Would it make sense, if you added a ServletContext Attribute during the initialization of the Default Broadcaster Factory (in configureDefaultBroadcasterFactory)?

That way I can listen for that attribute using a ServletContextAttributeListener and use that event to trigger booting up Spring. Not sure whether this is the ultimate solution, but at least for the time being it works.

Cheers,

Gunnar

PS:

* Just FYI, I started out using the Stmosphere DI Injector support and I used it to inject live broadcaster instances into the Spring application context but in order to have a better (life-cycle) handle I rather opted for using a Factorybean that does the respected lookups using e.g.

BroadcasterFactory.getDefault().get()  and BroadcasterFactory.getDefault().lookup(...). Still intend to blog about that one...
Reply | Threaded
Open this post in threaded view
|

Re: Adding ServletContext Attributes during initialization of the Default Broadcaster Factory

Jeanfrancois Arcand-4
Salut,

On 11-07-19 12:20 PM, ghillert wrote:

> Hi Jeanfrancois,
>
> I am working on a deeper integration between Atmosphere and Spring and I
> discovered the need for various use-cases, to make Broadcasters available
> (and the logic around to manage potentially multiple broadcasters) within
> the core Spring Application context. In this regard I hit the typically
> issues regarding Servlet versus Application context initialization.
>
> The CometD folks have a good write-up about the issues here:
>
> http://cometd.org/documentation/cometd-java/server/services/integration-spring
>
> For the time being, I am favoring the "Late Spring Initialization" option
> and thus making sure that the Atmosphere Servlet is loaded first, before
> Spring boots up. *
>
> Here is my question/request: Would it make sense, if you added a
> ServletContext Attribute during the initialization of the Default
> Broadcaster Factory (in configureDefaultBroadcasterFactory)?
>
> That way I can listen for that attribute using a
> ServletContextAttributeListener and use that event to trigger booting up
> Spring. Not sure whether this is the ultimate solution, but at least for the
> time being it works.

Good idea. Can you file a RFE here:

http://is.gd/e7S2SR

I will take a look once I'm back at work (searching for a job this
summer :-)).

A+

-- Jeanfrancois


>
> Cheers,
>
> Gunnar
>
> PS:
>
> * Just FYI, I started out using the Stmosphere DI Injector support and I
> used it to inject live broadcaster instances into the Spring application
> context but in order to have a better (life-cycle) handle I rather opted for
> using a Factorybean that does the respected lookups using e.g.
>
> BroadcasterFactory.getDefault().get()  and
> BroadcasterFactory.getDefault().lookup(...). Still intend to blog about that
> one...
>
>
> --
> View this message in context: http://atmosphere-users-mailling-list.2493822.n2.nabble.com/Adding-ServletContext-Attributes-during-initialization-of-the-Default-Broadcaster-Factory-tp6599345p6599345.html
> Sent from the Atmosphere users mailling list mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Adding ServletContext Attributes during initialization of the Default Broadcaster Factory

ghillert
Hi Jeanfrancois,

Thanks! I have created a Jira for this: http://java.net/jira/browse/ATMOSPHERE-157
 
Ultimately, though, I would love to be able to initialize the Atmosphere runtime directly from within Spring. But I haven't had the time, yet, to further investigate that goal.

Cheers,

Gunnar