Created
July 10, 2015 07:34
-
-
Save mp911de/424abb1b6fe790231597 to your computer and use it in GitHub Desktop.
fireAsync with CDI 2.0-EDR1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Experiment { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.enterprise.event.Event; | |
import javax.inject.Inject; | |
public class MyEventTrigger { | |
@Inject | |
Event<Experiment> event; | |
public void triggerEvent() { | |
event.fireAsync(new Experiment()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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