001/*
002 * (C) Copyright 2017 Nuxeo (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Florent Guillaume
018 */
019package org.nuxeo.runtime.pubsub;
020
021import java.util.List;
022import java.util.Map;
023import java.util.function.BiConsumer;
024
025import org.apache.commons.logging.Log;
026import org.apache.commons.logging.LogFactory;
027
028/**
029 * In-Memory implementation of {@link PubSubProvider}.
030 *
031 * @since 9.1
032 */
033public class MemPubSubProvider extends AbstractPubSubProvider {
034
035    private final Log log = LogFactory.getLog(MemPubSubProvider.class);
036
037    @Override
038    public void initialize(Map<String, List<BiConsumer<String, byte[]>>> subscribers) {
039        super.initialize(subscribers);
040        log.debug("Initialized");
041    }
042
043    @Override
044    public void close() {
045        log.debug("Closed");
046    }
047
048    @Override
049    public void publish(String topic, byte[] message) {
050        localPublish(topic, message);
051    }
052
053}