You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by almos <al...@ukr.net> on 2013/03/16 18:41:06 UTC

OpenEJB server events question

Hi,

I have a question in regards of server side events usage.
I want to register logic to be called once container goes down/application
is destroyed to do some actions using
http://rmannibucau.wordpress.com/2012/07/16/tomee-and-openejb-server-events/
as a reference.

It's not much clear how that works (asking because wasn't able to get it
working).
So I created file in META-INF/org.apache.openejb.extension and put there
class name of listener into EJB JAR

so its contents is following:
com.test.EventWatcher

So file structure is following:

app.ear
 |
 +--ejb.jar
       |
       +META-INF
       |      |
       |      +org.apache.openejb.extension
       +com
          |
          +test
              |
              + EventWatcher.class

EventWatcher class contains following methods:

public void assemblerDestroyed(@Observes AssemblerDestroyed event) {
	System.out.println("assembler has been destroyed");
}

public void appDestroyed(@Observes AssemblerBeforeApplicationDestroyed
event) {
	System.out.println("application is going to be destroyed");
}


however they aren't getting called (catalina.out doesn't have them).
Tried on TomEE 1.6 trunk.

What I am doing wrong?

Regards,
Alex





--
View this message in context: http://openejb.979440.n4.nabble.com/OpenEJB-server-events-question-tp4661558.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: OpenEJB server events question

Posted by Romain Manni-Bucau <rm...@gmail.com>.
think if you put the event in the container it will work

btw: https://issues.apache.org/jira/browse/TOMEE-833

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/3/16 almos <al...@ukr.net>

> Hi,
>
> I have a question in regards of server side events usage.
> I want to register logic to be called once container goes down/application
> is destroyed to do some actions using
>
> http://rmannibucau.wordpress.com/2012/07/16/tomee-and-openejb-server-events/
> as a reference.
>
> It's not much clear how that works (asking because wasn't able to get it
> working).
> So I created file in META-INF/org.apache.openejb.extension and put there
> class name of listener into EJB JAR
>
> so its contents is following:
> com.test.EventWatcher
>
> So file structure is following:
>
> app.ear
>  |
>  +--ejb.jar
>        |
>        +META-INF
>        |      |
>        |      +org.apache.openejb.extension
>        +com
>           |
>           +test
>               |
>               + EventWatcher.class
>
> EventWatcher class contains following methods:
>
> public void assemblerDestroyed(@Observes AssemblerDestroyed event) {
>         System.out.println("assembler has been destroyed");
> }
>
> public void appDestroyed(@Observes AssemblerBeforeApplicationDestroyed
> event) {
>         System.out.println("application is going to be destroyed");
> }
>
>
> however they aren't getting called (catalina.out doesn't have them).
> Tried on TomEE 1.6 trunk.
>
> What I am doing wrong?
>
> Regards,
> Alex
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/OpenEJB-server-events-question-tp4661558.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>