package com.base.biz.mq.factory;

import com.base.orbit.mq.handler.MessageHandler;
import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;



public class HandlerMqFactory {

    private static Map<String, MessageHandler> map = new HashMap<>();

    public static void register(String topic, MessageHandler handler) {
        if (StringUtils.isEmpty(topic) || null == handler) {
            return;
        }
        map.put(topic, handler);
    }

    public static MessageHandler getInvokeHandlerByTopic(String topic) {
        return map.get(topic);
    }
}
