All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.reactivecommons.async.starter.senders.EventBusConfig Maven / Gradle / Ivy

There is a newer version: 5.2.2
Show newest version
package org.reactivecommons.async.starter.senders;

import org.reactivecommons.api.domain.DomainEventBus;
import org.reactivecommons.async.starter.config.ConnectionManager;
import org.reactivecommons.async.starter.config.ReactiveCommonsConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

@Configuration
@Import(ReactiveCommonsConfig.class)
public class EventBusConfig {

    @Bean
    public DomainEventBus genericDomainEventBus(ConnectionManager manager) {
        ConcurrentMap domainEventBuses = new ConcurrentHashMap<>();
        manager.forDomain((domain, provider) -> domainEventBuses.put(domain, provider.getDomainBus()));
        return new GenericDomainEventBus(domainEventBuses);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy