
ru.tinkoff.gatling.amqp.client.AmqpPublisher.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gatling-amqp-plugin_2.13 Show documentation
Show all versions of gatling-amqp-plugin_2.13 Show documentation
Plugin for support performance testing with AMQP in Gatling
The newest version!
package ru.tinkoff.gatling.amqp.client
import io.gatling.core.session.Session
import ru.tinkoff.gatling.amqp.protocol.AmqpComponents
import ru.tinkoff.gatling.amqp.request._
class AmqpPublisher(destination: AmqpExchange, components: AmqpComponents) extends WithAmqpChannel {
def publish(message: AmqpProtocolMessage, session: Session): Unit = {
destination match {
case AmqpDirectExchange(name, routingKey, _) =>
for {
exName <- name(session)
exKey <- routingKey(session)
} withChannel(channel => channel.basicPublish(exName, exKey, message.amqpProperties, message.payload))
case AmqpQueueExchange(name, _) =>
name(session).foreach(qName =>
withChannel(channel => channel.basicPublish("", qName, message.amqpProperties, message.payload)),
)
case AmqpTopicExchange(name, routingKey, _) =>
for {
exName <- name(session)
exKey <- routingKey(session)
} withChannel(channel => channel.basicPublish(exName, exKey, message.amqpProperties, message.payload))
}
}
override protected val pool: AmqpConnectionPool = components.connectionPublishPool
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy