org.reactivecommons.async.kafka.config.DomainHandlers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of async-kafka-starter Show documentation
Show all versions of async-kafka-starter Show documentation
Abstract your broker with semantic async messages
package org.reactivecommons.async.kafka.config;
import org.reactivecommons.async.commons.HandlerResolver;
import java.util.Map;
import java.util.TreeMap;
public class DomainHandlers {
private final Map handlers = new TreeMap<>();
public void add(String domain, HandlerResolver resolver) {
this.handlers.put(domain, resolver);
}
public HandlerResolver get(String domain) {
HandlerResolver handlerResolver = handlers.get(domain);
if (handlerResolver == null) {
throw new RuntimeException("You are trying to use the domain " + domain
+ " but this connection is not defined");
}
return handlerResolver;
}
}