* @author Christos KK Loverdos <loverdos@gmail.com>.
*/
class RabbitMQConfiguration(val confModel: RabbitMQConfigurationModel) extends AMQPConfiguration with Loggable {
- private[v091] val _rabbitConnectionFactory = new JackRabbitConnectionFactory
+ private[v091] val _rabbitConnectionFactory = {
+ val _cf = new JackRabbitConnectionFactory
+
+ _cf.setUsername(confModel.username)
+ _cf.setPassword(confModel.password)
+ _cf.setHost(confModel.host)
+ _cf.setPort(confModel.port)
+ _cf.setVirtualHost(confModel.virtualHost)
+
+ _cf
+ }
private val _name = confModel.name
def name = _name
object RabbitMQConfiguration {
-
object RCFolders {
val rabbitmq = "rabbitmq"
-
- val producers = "producers"
- val consumers = "consumers"
- }
-
- object PropFiles {
- val configurations = "configuration.properties"
}
-
- object PropKeys {
- val configurations = "configurations"
-
- // configuration
- val addresses = "addresses"
- val username = "username"
- val password = "password"
- val host = "host"
- val virtualHost = "virtualHost"
- val port = "port"
- val connections = "connections"
-
- // connection
- val exchange = "exchange"
- val exchangeType = "exchangeType"
- val exchangeIsDurable = "exchangeIsDurable"
- val producers = "producers"
- val consumers = "consumers"
-
- // producer
- val routingKey = "routingKey"
-
- // consumer
- val queue = "queue"
- }
-
}
\ No newline at end of file
def name = confModel.name
override def toString = {
- val connName = owner.name
- val confName = owner.owner.name
- "RabbitMQConsumer(%s/%s/%s)".format(confName, connName, name)
- }
+ val connName = owner.name
+ val confName = owner.owner.name
+ "RabbitMQConsumer(%s/%s/%s)".format(confName, connName, name)
+ }
}
\ No newline at end of file
}
def publish(message: String, headers: Map[String, String] = Map()) = {
- _publish(message, headers){_ =>}{_ => ()} {_ => logger.error("publish() from producer %ss".format())}
+ _publish(message, headers){_ =>}{_ => ()} {_ => logger.error("publish() from producer %s".format())}
}
def publishWithConfirm(message: String, headers: Map[String, String] = Map()) = {
- _publish(message, headers) { _.confirmSelect() }{ _.waitForConfirms() } {_ => logger.error("publishWithConfirm() from producer %ss".format())}
+ _publish(message, headers) { _.confirmSelect() }{ _.waitForConfirms() } {_ => logger.error("publishWithConfirm() from producer %s".format())}
}
override def toString = {
- val connName = owner.name
- val confName = owner.owner.name
- "RabbitMQProducer(%s/%s/%s)".format(confName, connName, name)
+ "RabbitMQProducer(%s/%s/%s)".format(owner.owner.name, owner.name, name)
}
}
\ No newline at end of file