2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.openflow.md.queue;
10 import java.util.Collection;
11 import java.util.List;
14 import org.opendaylight.openflowplugin.openflow.md.core.ConnectionConductor;
15 import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
16 import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
19 * This processing mechanism based on queue. Processing consists of 2 steps: translate and publish.
20 * Proposed workflow (might slightly deviate in implementations):
22 * <li>messages of input type are pushed in (via {@link QueueProcessor#push(Object, ConnectionConductor)} and similar)</li>
23 * <li>ticket (executable task) is build upon each pushed message and enqueued</li>
24 * <li>ticket is translated using appropriate translator</li>
25 * <li>ticket is dequeued and result is published by appropriate popListener</li>
27 * Message order might be not important, e.g. when speed is of the essence
28 * @param <IN> source type
29 * @param <OUT> result type
31 public interface QueueProcessor<IN, OUT> extends MessageSourcePollRegistrator<QueueKeeper<IN>>, Enqueuer<QueueItem<IN>> {
34 * @param translatorMapping translators for message processing
36 void setTranslatorMapping(Map<TranslatorKey, Collection<IMDMessageTranslator<IN, List<OUT>>>> translatorMapping);
39 * @param popListenersMapping listeners invoked when processing done
41 void setPopListenersMapping(Map<Class<? extends OUT>, Collection<PopListener<OUT>>> popListenersMapping);