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

io.siddhi.extension.io.kafka.util.KafkaReplayResponseSourceRegistry Maven / Gradle / Ivy

/*
 * Copyright (c)  2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package io.siddhi.extension.io.kafka.util;

import io.siddhi.extension.io.kafka.source.KafkaReplayResponseSource;

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

/**
 * a class to register KafkaReplayResponseSource with respective sink.id or source.id. Used by KafkaReplayRequestSink
 * to push responses
 */
public class KafkaReplayResponseSourceRegistry {
    private static KafkaReplayResponseSourceRegistry instance = new KafkaReplayResponseSourceRegistry();
    private Map kafkaReplayResponseSourceHashMap = Collections.synchronizedMap(
            new HashMap<>());

    private KafkaReplayResponseSourceRegistry() {}

    public static KafkaReplayResponseSourceRegistry getInstance() {
        return instance;
    }

    public void putKafkaReplayResponseSource(String key, KafkaReplayResponseSource source) {
        kafkaReplayResponseSourceHashMap.put(key, source);
    }

    public KafkaReplayResponseSource getKafkaReplayResponseSource(String key) {
        return kafkaReplayResponseSourceHashMap.get(key);
    }
    public void removeKafkaReplayResponseSource(String key) {
        kafkaReplayResponseSourceHashMap.remove(key);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy