Skip to content

Instantly share code, notes, and snippets.

@johnament
Created February 25, 2011 01:07
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 johnament/843239 to your computer and use it in GitHub Desktop.
Save johnament/843239 to your computer and use it in GitHub Desktop.
Demonstrates event firing, both observers get called when es3 is fired.
@RequestScoped
@Path("/send")
public class SendEventResource {
@Inject @QualOne Event<String> es1;
@Inject @QualTwo Event<String> es2;
@Inject @QualOne @QualTwo Event<String> es3;
@Inject Logger logger;
@Path("/{data}")
@GET
@Produces("text/plain")
public String send(@PathParam("data") String s) {
es3.fire(s);
return s;
}
public void obsString(@Observes @QualOne String s) {
logger.info("Observed QualOne");
}
public void obsString2(@Observes @QualTwo String s) {
logger.info("Observed QualTwo");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment