Last active
November 24, 2021 08:09
-
-
Save thomasmartin-whoz/aaef8d91bdeeae8e9873e80d95da44f9 to your computer and use it in GitHub Desktop.
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
@Slf4j | |
@EnableWhozEvent([ProfilePublisher, SkillPublisher]) | |
class WhozPublisherEventConfig { | |
/** | |
* Application context from micronaut. | |
* Event listener must be registered on it as singletons, | |
* because the bean resolver of the micronaut application listener only evaluates singletons. | |
*/ | |
@Inject | |
MicronautApplicationContext applicationContext | |
@Bean | |
@Inject | |
ProfileEventListener profileEventListener(@Qualifier(PROFILE) MessageChannel eventChannel) { | |
log.info("Enabling whoz events and registering a spring listener to output to $PROFILE") | |
ProfileEventListener profileEventListener = new ProfileEventListener(eventChannel) | |
applicationContext.beanFactory.registerSingleton("profileEventListener", profileEventListener) | |
return profileEventListener | |
} | |
@Bean | |
@Inject | |
SkillEventListener skillEventListener(@Qualifier(SKILL) MessageChannel eventChannel) { | |
log.info("Enabling whoz events and registering a spring listener to output to $SKILL") | |
SkillEventListener skillEventListener = new SkillEventListener(eventChannel) | |
applicationContext.beanFactory.registerSingleton("skillEventListener", skillEventListener) | |
return skillEventListener | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment