Search in sources :

Example 1 with EventBus

use of reactor.bus.EventBus in project cloudbreak by hortonworks.

the class ReactorFlowManagerTest method setUp.

@Before
public void setUp() {
    reset(reactor);
    reset(eventFactory);
    when(reactor.notify((Object) anyObject(), any(Event.class))).thenReturn(new EventBus(new ThreadPoolExecutorDispatcher(1, 1)));
    Acceptable acceptable = new Acceptable() {

        @Override
        public Promise<Boolean> accepted() {
            Promise<Boolean> a = new Promise<>();
            a.accept(true);
            return a;
        }

        @Override
        public Long getStackId() {
            return stackId;
        }
    };
    Stack stack = TestUtil.stack();
    stack.setCluster(TestUtil.cluster());
    when(stackService.get(anyLong())).thenReturn(stack);
    when(stackService.getById(anyLong())).thenReturn(TestUtil.stack());
    when(stackService.getByIdView(anyLong())).thenReturn(TestUtil.stackView());
    when(eventFactory.createEventWithErrHandler(anyObject())).thenReturn(new Event<>(acceptable));
}
Also used : Promise(reactor.rx.Promise) Acceptable(com.sequenceiq.cloudbreak.cloud.Acceptable) Event(reactor.bus.Event) ClusterTerminationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent) ThreadPoolExecutorDispatcher(reactor.core.dispatch.ThreadPoolExecutorDispatcher) EventBus(reactor.bus.EventBus) Stack(com.sequenceiq.cloudbreak.domain.Stack) Before(org.junit.Before)

Example 2 with EventBus

use of reactor.bus.EventBus in project kylo by Teradata.

the class ReactorConfiguration method respondibleAlertsEventBus.

@Bean(name = "respondableAlertsEventBus")
public EventBus respondibleAlertsEventBus() {
    Environment env = reactorEnvironment();
    Logger log = LoggerFactory.getLogger(EventBus.class.getName() + "- Respondavle alerts event bus");
    return EventBus.config().env(env).dispatcher(env.getDefaultDispatcher()).dispatchErrorHandler((t) -> {
        log.error("Alert event bus dispatch error", t);
    }).get();
}
Also used : Configuration(org.springframework.context.annotation.Configuration) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) EventBus(reactor.bus.EventBus) Bean(org.springframework.context.annotation.Bean) MetadataEventService(com.thinkbiganalytics.metadata.api.event.MetadataEventService) Environment(reactor.Environment) Environment(reactor.Environment) Logger(org.slf4j.Logger) Bean(org.springframework.context.annotation.Bean)

Example 3 with EventBus

use of reactor.bus.EventBus in project kylo by Teradata.

the class ReactorConfiguration method alertsEventBus.

@Bean(name = "alertsEventBus")
public EventBus alertsEventBus() {
    Environment env = reactorEnvironment();
    Logger log = LoggerFactory.getLogger(EventBus.class.getName() + "- Alerts event bus");
    return EventBus.config().env(env).dispatcher(env.getDefaultDispatcher()).dispatchErrorHandler((t) -> {
        log.error("Alert event bus dispatch error", t);
    }).get();
}
Also used : Configuration(org.springframework.context.annotation.Configuration) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) EventBus(reactor.bus.EventBus) Bean(org.springframework.context.annotation.Bean) MetadataEventService(com.thinkbiganalytics.metadata.api.event.MetadataEventService) Environment(reactor.Environment) Environment(reactor.Environment) Logger(org.slf4j.Logger) Bean(org.springframework.context.annotation.Bean)

Example 4 with EventBus

use of reactor.bus.EventBus in project kylo by Teradata.

the class ReactorConfiguration method metadataEventBus.

@Bean(name = "metadataEventBus")
public EventBus metadataEventBus() {
    Environment env = reactorEnvironment();
    Logger log = LoggerFactory.getLogger(EventBus.class.getName() + "- Metadata event bus");
    return EventBus.config().env(env).dispatcher(env.getDefaultDispatcher()).dispatchErrorHandler((t) -> {
        log.error("Metadata event bus dispatch error", t);
    }).get();
}
Also used : Configuration(org.springframework.context.annotation.Configuration) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) EventBus(reactor.bus.EventBus) Bean(org.springframework.context.annotation.Bean) MetadataEventService(com.thinkbiganalytics.metadata.api.event.MetadataEventService) Environment(reactor.Environment) Environment(reactor.Environment) Logger(org.slf4j.Logger) Bean(org.springframework.context.annotation.Bean)

Aggregations

EventBus (reactor.bus.EventBus)4 MetadataEventService (com.thinkbiganalytics.metadata.api.event.MetadataEventService)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 Bean (org.springframework.context.annotation.Bean)3 Configuration (org.springframework.context.annotation.Configuration)3 Environment (reactor.Environment)3 Acceptable (com.sequenceiq.cloudbreak.cloud.Acceptable)1 ClusterTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 Before (org.junit.Before)1 Event (reactor.bus.Event)1 ThreadPoolExecutorDispatcher (reactor.core.dispatch.ThreadPoolExecutorDispatcher)1 Promise (reactor.rx.Promise)1