// Path: koper-core/src/main/java/koper/ListenerRegistry.java
// public class ListenerRegistry {
// 
//     private Map<String, Object> listenerMap = new ConcurrentHashMap<>();
// 
//     /**
//      * 注册监听器。 register listener
//      *
//      * @param topic
//      * @param listener
//      */
//     public void register(String topic, Object listener) {
// 
//         Object listener1 = listenerMap.get(topic);
//         if (listener1 != null) {
//             throw new IllegalArgumentException("Listener with the same topic has been registered! topic=" + topic
//                     + ". Existed listener " + listener1 + ". New listener " + listener1);
//         } else
//             listenerMap.put(topic, listener);
// 
//     }
// 
//     public Map<String, Object> getListenerMap() {
//         return listenerMap;
//     }
// }
// 
// Path: koper-core/src/main/java/koper/MessageCenter.java
// public interface MessageCenter<T> {
// 
//     @Deprecated
//     T takeMessage();
// 
//     void putMessage(T msg);
// 
//     Router getRouter();
// 
// }


import koper.ListenerRegistry;
import koper.MessageCenter;
import java.util.Properties;
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF 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 koper.client;



/**
 * ConsumerThread. 每个topic由一个线程接收。
 *
 * @author kk
 * @since 1.0
 */
public class MessageReceiverThread implements Runnable {
    private Properties properties;
    private MessageReceiver messageReceiver;
    private MessageCenter messageCenter;
    private ListenerRegistry listenerRegistry;
    private int partitions;

// Path: koper-core/src/main/java/koper/ListenerRegistry.java
// public class ListenerRegistry {
// 
//     private Map<String, Object> listenerMap = new ConcurrentHashMap<>();
// 
//     /**
//      * 注册监听器。 register listener
//      *
//      * @param topic
//      * @param listener
//      */
//     public void register(String topic, Object listener) {
// 
//         Object listener1 = listenerMap.get(topic);
//         if (listener1 != null) {
//             throw new IllegalArgumentException("Listener with the same topic has been registered! topic=" + topic
//                     + ". Existed listener " + listener1 + ". New listener " + listener1);
//         } else
//             listenerMap.put(topic, listener);
// 
//     }
// 
//     public Map<String, Object> getListenerMap() {
//         return listenerMap;
//     }
// }
// 
// Path: koper-core/src/main/java/koper/MessageCenter.java
// public interface MessageCenter<T> {
// 
//     @Deprecated
//     T takeMessage();
// 
//     void putMessage(T msg);
// 
//     Router getRouter();
// 
// }


// Path: koper-core/src/main/java/koper/client/MessageReceiverThread.java
import koper.ListenerRegistry;
import koper.MessageCenter;
import java.util.Properties;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF 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 koper.client;



/**
 * ConsumerThread. 每个topic由一个线程接收。
 *
 * @author kk
 * @since 1.0
 */
public class MessageReceiverThread implements Runnable {
    private Properties properties;
    private MessageReceiver messageReceiver;
    private MessageCenter messageCenter;
    private ListenerRegistry listenerRegistry;
    private int partitions;

    public MessageReceiverThread(Properties properties, MessageReceiver messageReceiver, MessageCenter messageCenter, ListenerRegistry listenerRegistry, int partitions) {