Search in sources :

Example 1 with ConsumerNotFoundHandler

use of com.sequenceiq.flow.reactor.handler.ConsumerNotFoundHandler in project cloudbreak by hortonworks.

the class FlowIntegrationTestConfig method reactor.

@Bean
public EventBus reactor(MDCCleanerThreadPoolExecutor threadPoolExecutor, Environment env) {
    MpscDispatcher dispatcher = new MpscDispatcher("test-dispatcher");
    EventBus eventBus = new EventBusSpec().env(env).dispatcher(dispatcher).traceEventPath().consumerNotFoundHandler(new ConsumerNotFoundHandler()).get();
    return new ConsumerCheckerEventBus(eventBus);
}
Also used : EventBusSpec(reactor.bus.spec.EventBusSpec) MpscDispatcher(reactor.core.dispatch.MpscDispatcher) ConsumerCheckerEventBus(com.sequenceiq.flow.reactor.eventbus.ConsumerCheckerEventBus) EventBus(reactor.bus.EventBus) ConsumerNotFoundHandler(com.sequenceiq.flow.reactor.handler.ConsumerNotFoundHandler) ConsumerCheckerEventBus(com.sequenceiq.flow.reactor.eventbus.ConsumerCheckerEventBus) MockBean(org.springframework.boot.test.mock.mockito.MockBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ConsumerNotFoundHandler

use of com.sequenceiq.flow.reactor.handler.ConsumerNotFoundHandler in project cloudbreak by hortonworks.

the class EventBusConfig method reactor.

@Bean
public EventBus reactor(MDCCleanerThreadPoolExecutor threadPoolExecutor, Environment env) {
    ThreadPoolExecutorDispatcher dispatcher = new ThreadPoolExecutorDispatcher(eventBusThreadPoolBacklogSize, eventBusThreadPoolCoreSize, threadPoolExecutor);
    EventBus eventBus = new EventBusSpec().env(env).dispatcher(dispatcher).traceEventPath().dispatchErrorHandler(throwable -> {
        handleFlowFail(throwable, dispatcher);
        LOGGER.error("Exception happened in dispatcher", throwable);
    }).uncaughtErrorHandler(throwable -> {
        handleFlowFail(throwable, dispatcher);
        LOGGER.error("Uncaught exception happened", throwable);
    }).consumerNotFoundHandler(new ConsumerNotFoundHandler()).get();
    return new ConsumerCheckerEventBus(eventBus);
}
Also used : Arrays(java.util.Arrays) EventCanNotBeDeliveredException(com.sequenceiq.flow.reactor.eventbus.EventCanNotBeDeliveredException) ConsumerNotFoundHandler(com.sequenceiq.flow.reactor.handler.ConsumerNotFoundHandler) Timer(reactor.fn.timer.Timer) LoggerFactory(org.slf4j.LoggerFactory) MDCBuilder(com.sequenceiq.cloudbreak.logger.MDCBuilder) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) ConsumerCheckerEventBus(com.sequenceiq.flow.reactor.eventbus.ConsumerCheckerEventBus) NamedDaemonThreadFactory(reactor.core.support.NamedDaemonThreadFactory) ApplicationFlowInformation(com.sequenceiq.flow.core.ApplicationFlowInformation) Event(reactor.bus.Event) ThreadPoolExecutorDispatcher(reactor.core.dispatch.ThreadPoolExecutorDispatcher) LinkedHashSet(java.util.LinkedHashSet) Logger(org.slf4j.Logger) EventBus(reactor.bus.EventBus) EventBusSpec(reactor.bus.spec.EventBusSpec) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) Collectors(java.util.stream.Collectors) MDCCleanerThreadPoolExecutor(com.sequenceiq.cloudbreak.logger.concurrent.MDCCleanerThreadPoolExecutor) TimeUnit(java.util.concurrent.TimeUnit) Configuration(org.springframework.context.annotation.Configuration) Exceptions(reactor.core.support.Exceptions) Lazy(org.springframework.context.annotation.Lazy) FlowLogDBService(com.sequenceiq.flow.service.flowlog.FlowLogDBService) Bean(org.springframework.context.annotation.Bean) Environment(reactor.Environment) EventBusSpec(reactor.bus.spec.EventBusSpec) ThreadPoolExecutorDispatcher(reactor.core.dispatch.ThreadPoolExecutorDispatcher) ConsumerCheckerEventBus(com.sequenceiq.flow.reactor.eventbus.ConsumerCheckerEventBus) EventBus(reactor.bus.EventBus) ConsumerNotFoundHandler(com.sequenceiq.flow.reactor.handler.ConsumerNotFoundHandler) ConsumerCheckerEventBus(com.sequenceiq.flow.reactor.eventbus.ConsumerCheckerEventBus) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConsumerCheckerEventBus (com.sequenceiq.flow.reactor.eventbus.ConsumerCheckerEventBus)2 ConsumerNotFoundHandler (com.sequenceiq.flow.reactor.handler.ConsumerNotFoundHandler)2 Bean (org.springframework.context.annotation.Bean)2 EventBus (reactor.bus.EventBus)2 EventBusSpec (reactor.bus.spec.EventBusSpec)2 MDCBuilder (com.sequenceiq.cloudbreak.logger.MDCBuilder)1 MDCCleanerThreadPoolExecutor (com.sequenceiq.cloudbreak.logger.concurrent.MDCCleanerThreadPoolExecutor)1 ApplicationFlowInformation (com.sequenceiq.flow.core.ApplicationFlowInformation)1 EventCanNotBeDeliveredException (com.sequenceiq.flow.reactor.eventbus.EventCanNotBeDeliveredException)1 FlowLogDBService (com.sequenceiq.flow.service.flowlog.FlowLogDBService)1 Arrays (java.util.Arrays)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Value (org.springframework.beans.factory.annotation.Value)1 MockBean (org.springframework.boot.test.mock.mockito.MockBean)1