blob: bb71a3753185b299c34f8f42c97dad0215574c7c [file] [log] [blame]
ADARA Networks1fb1eb12016-09-01 12:04:07 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.rabbitmq.impl;
17
18import java.util.Map;
19import java.util.concurrent.BlockingQueue;
20
21import org.onosproject.rabbitmq.api.MQTransport;
22import org.onosproject.rabbitmq.api.Manageable;
23
24import static org.onosproject.rabbitmq.api.MQConstants.*;
25
26/**
27 * Provides handle to call MQSender for message delivery.
28 */
29public class MQTransportImpl implements MQTransport {
30
31 @Override
32 public Manageable registerProducer(BrokerHost host,
33 Map<String, String> channelConf,
34 BlockingQueue<MessageContext> queue) {
35 String exchangeName = channelConf.get(EXCHANGE_NAME_PROPERTY);
36 String routingKey = channelConf.get(ROUTING_KEY_PROPERTY);
37 String queueName = channelConf.get(QUEUE_NAME_PROPERTY);
38 return new MQSender(queue, exchangeName, routingKey, queueName,
39 host.getUrl());
40 }
41
42}