ADARA Networks | 1fb1eb1 | 2016-09-01 12:04:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
ADARA Networks | 1fb1eb1 | 2016-09-01 12:04:07 -0700 | [diff] [blame] | 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 | */ |
| 16 | package org.onosproject.rabbitmq.impl; |
| 17 | |
| 18 | import java.util.Map; |
| 19 | import java.util.concurrent.BlockingQueue; |
| 20 | |
| 21 | import org.onosproject.rabbitmq.api.MQTransport; |
| 22 | import org.onosproject.rabbitmq.api.Manageable; |
| 23 | |
| 24 | import static org.onosproject.rabbitmq.api.MQConstants.*; |
| 25 | |
| 26 | /** |
| 27 | * Provides handle to call MQSender for message delivery. |
| 28 | */ |
| 29 | public 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 | } |