public void afterBeanDiscovery(@Observes AfterBeanDiscovery event) { // not overriding notify method -> definition error event.<Foo>addObserverMethod().read(fooObserverMethod).async(true).priority(ObserverMethod.DEFAULT_PRIORITY); }
void observesPearPOM(@Observes ProcessObserverMethod<Pear, FruitObserver> event) { // add @Ripe and @Delicious to the observed type // make observer asynchronous // set priority event.configureObserverMethod() .addQualifiers(Ripe.RipeLiteral.INSTANCE, Delicious.DeliciousLiteral.INSTANCE) .async(true) .priority(ObserverMethod.DEFAULT_PRIORITY + 100); }
void observePOM(@Observes ProcessObserverMethod<Box, Worker> event) { event.configureObserverMethod().async(true); try { event.setObserverMethod(new BoxObserverMethod()); } catch (IllegalStateException e) { // expected should blow up with ISE POM_ISE_CAUGHT = true; } }
void observePOMReverse(@Observes ProcessObserverMethod<Box, Worker> event) { event.setObserverMethod(new BoxObserverMethod()); try { event.configureObserverMethod().async(true); } catch (IllegalStateException e) { // expected should blow up with ISE POM_REVERSE_ISE_CAUGHT = true; } } }