use of com.canoo.dp.impl.server.event.DefaultDolphinEventBus in project dolphin-platform by canoo.
the class DolphinPlatformSpringTestBootstrap method createEventBus.
/**
* Method to create a spring managed {@link RemotingEventBus} instance in singleton scope.
*
* @return the instance
*/
@Bean(name = "dolphinEventBus")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
protected RemotingEventBus createEventBus(final TestConfiguration testConfiguration) {
Assert.requireNonNull(testConfiguration, "testConfiguration");
final DolphinContextProvider contextProvider = new DolphinContextProvider() {
@Override
public DolphinContext getContext(ClientSession clientSession) {
return getCurrentDolphinContext();
}
@Override
public DolphinContext getContextById(String clientSessionId) {
return getCurrentDolphinContext();
}
@Override
public DolphinContext getCurrentDolphinContext() {
return testConfiguration.getDolphinTestContext();
}
};
final DefaultDolphinEventBus eventBus = new DefaultDolphinEventBus();
eventBus.init(contextProvider, new ClientSessionLifecycleHandlerImpl());
return eventBus;
}
Aggregations