Skip to content

Instantly share code, notes, and snippets.

@mp911de
Created July 10, 2015 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mp911de/424abb1b6fe790231597 to your computer and use it in GitHub Desktop.
Save mp911de/424abb1b6fe790231597 to your computer and use it in GitHub Desktop.
fireAsync with CDI 2.0-EDR1
public class Experiment {
}
import javax.enterprise.event.Event;
import javax.inject.Inject;
public class MyEventTrigger {
@Inject
Event<Experiment> event;
public void triggerEvent() {
event.fireAsync(new Experiment());
}
}
import javax.enterprise.event.ObservesAsync;
public class MyObserver {
public void observes(@ObservesAsync Experiment experiment) {
System.out.println("Yay, I'm called async!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment