You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Wiktorowski Maximilien <m....@free.fr> on 2013/11/06 22:20:45 UTC

Events

Hi,

I'm starting a project in a Java SE environment and want to take a look 
at deltaspike.

I've used CdiContainerLoader to boot the container and BeanProvider to 
initialize some beans just after the boot.

I then want to dispatch a custom event. How can i achieve this in a 
deltaspike context ?
In weld i'll do something like: |weld.event().select(Bar.class).fire(new 
Bar()); |

Thanks
Maximilien

Re: Events

Posted by Maximilien Wiktorowski <ma...@mediamana.fr>.
Hi strub,

Thanks for the solution.
I didn't find fire method on BeanManagerProvider.getInstance() so i've 
done it using cdiContainer.getBeanManager().fireEvent(

Best regards,
Maximilien

Le 06/11/2013 23:04, Mark Struberg a écrit :
> Hi Maximilian!
>
> Once you booted the CDI container, all JSR-299 stuff (which is not depending on a spec you do not have in your project) should work.
> Of course you need to trigger the resolving of the 'outer' contextual instances somehow. Either via the BeanManager you get from CdiControl or via BeanProvider (should not make any difference).
>
> For example: for dispatching a custom event you could use
>
> BeanManagerProvider.getInstance().fire(....)
>
>
> LieGrue,
> strub
>
>
>
> ----- Original Message -----
>> From: Wiktorowski Maximilien <m....@free.fr>
>> To: users@deltaspike.apache.org
>> Cc:
>> Sent: Wednesday, 6 November 2013, 22:20
>> Subject: Events
>>
>> Hi,
>>
>> I'm starting a project in a Java SE environment and want to take a look
>> at deltaspike.
>>
>> I've used CdiContainerLoader to boot the container and BeanProvider to
>> initialize some beans just after the boot.
>>
>> I then want to dispatch a custom event. How can i achieve this in a
>> deltaspike context ?
>> In weld i'll do something like: |weld.event().select(Bar.class).fire(new
>> Bar()); |
>>
>> Thanks
>> Maximilien
>>
>


Re: Events

Posted by Mark Struberg <st...@yahoo.de>.
Hi Maximilian!

Once you booted the CDI container, all JSR-299 stuff (which is not depending on a spec you do not have in your project) should work.
Of course you need to trigger the resolving of the 'outer' contextual instances somehow. Either via the BeanManager you get from CdiControl or via BeanProvider (should not make any difference). 

For example: for dispatching a custom event you could use

BeanManagerProvider.getInstance().fire(....) 


LieGrue,
strub



----- Original Message -----
> From: Wiktorowski Maximilien <m....@free.fr>
> To: users@deltaspike.apache.org
> Cc: 
> Sent: Wednesday, 6 November 2013, 22:20
> Subject: Events
> 
> Hi,
> 
> I'm starting a project in a Java SE environment and want to take a look 
> at deltaspike.
> 
> I've used CdiContainerLoader to boot the container and BeanProvider to 
> initialize some beans just after the boot.
> 
> I then want to dispatch a custom event. How can i achieve this in a 
> deltaspike context ?
> In weld i'll do something like: |weld.event().select(Bar.class).fire(new 
> Bar()); |
> 
> Thanks
> Maximilien
>