root / logic / src / main / scala / gr / grnet / aquarium / messaging / amqp / rabbitmq / v091 / RabbitMQConfiguration.scala @ 3c96bea0
History | View | Annotate | Download (3.1 kB)
1 |
/* |
---|---|
2 |
* Copyright 2011 GRNET S.A. All rights reserved. |
3 |
* |
4 |
* Redistribution and use in source and binary forms, with or |
5 |
* without modification, are permitted provided that the following |
6 |
* conditions are met: |
7 |
* |
8 |
* 1. Redistributions of source code must retain the above |
9 |
* copyright notice, this list of conditions and the following |
10 |
* disclaimer. |
11 |
* |
12 |
* 2. Redistributions in binary form must reproduce the above |
13 |
* copyright notice, this list of conditions and the following |
14 |
* disclaimer in the documentation and/or other materials |
15 |
* provided with the distribution. |
16 |
* |
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 |
* POSSIBILITY OF SUCH DAMAGE. |
29 |
* |
30 |
* The views and conclusions contained in the software and |
31 |
* documentation are those of the authors and should not be |
32 |
* interpreted as representing official policies, either expressed |
33 |
* or implied, of GRNET S.A. |
34 |
*/ |
35 |
|
36 |
package gr.grnet.aquarium.messaging.amqp |
37 |
package rabbitmq |
38 |
package v091 |
39 |
|
40 |
import com.rabbitmq.client.{Channel => JackRabbitChannel, Connection => JackRabbitConnection, ConnectionFactory => JackRabbitConnectionFactory} |
41 |
import confmodel.RabbitMQConfigurationModel |
42 |
import gr.grnet.aquarium.util.Loggable |
43 |
|
44 |
/** |
45 |
* |
46 |
* @author Christos KK Loverdos <loverdos@gmail.com>. |
47 |
*/ |
48 |
class RabbitMQConfiguration(val confModel: RabbitMQConfigurationModel) extends AMQPConfiguration with Loggable { |
49 |
private[v091] val _rabbitConnectionFactory = new JackRabbitConnectionFactory |
50 |
|
51 |
private val _name = confModel.name |
52 |
def name = _name |
53 |
|
54 |
private lazy val _connections = confModel.connections.map(new RabbitMQConnection(this, _)) |
55 |
def connections = _connections |
56 |
|
57 |
override def toString = { |
58 |
"RabbitMQConfiguration(%s)".format(name) |
59 |
} |
60 |
} |
61 |
|
62 |
|
63 |
object RabbitMQConfiguration { |
64 |
|
65 |
object RCFolders { |
66 |
val rabbitmq = "rabbitmq" |
67 |
|
68 |
val producers = "producers" |
69 |
val consumers = "consumers" |
70 |
} |
71 |
|
72 |
object PropFiles { |
73 |
val configurations = "configuration.properties" |
74 |
} |
75 |
|
76 |
object PropKeys { |
77 |
val configurations = "configurations" |
78 |
|
79 |
// configuration |
80 |
val addresses = "addresses" |
81 |
val username = "username" |
82 |
val password = "password" |
83 |
val host = "host" |
84 |
val virtualHost = "virtualHost" |
85 |
val port = "port" |
86 |
val connections = "connections" |
87 |
|
88 |
// connection |
89 |
val exchange = "exchange" |
90 |
val exchangeType = "exchangeType" |
91 |
val exchangeIsDurable = "exchangeIsDurable" |
92 |
val producers = "producers" |
93 |
val consumers = "consumers" |
94 |
|
95 |
// producer |
96 |
val routingKey = "routingKey" |
97 |
|
98 |
// consumer |
99 |
val queue = "queue" |
100 |
} |
101 |
|
102 |
} |