public class RabbitMQClient
extends java.lang.Object
Constructor and Description |
---|
RabbitMQClient(java.lang.String uri)
Builds a new instance of
RabbitMQClient |
RabbitMQClient(java.lang.String serverHost,
int serverPort,
java.lang.String serverVirtualHost,
java.lang.String serverUsername,
java.lang.String serverPassword)
Builds a new instance of
RabbitMQClient |
Modifier and Type | Method and Description |
---|---|
void |
bind(java.lang.String exchangeName,
java.lang.String exchangeOptions,
java.lang.String queueName,
java.lang.String queueOptions,
java.lang.String bindingKey,
java.lang.String bindingArguments)
Creates a relationship between an exchange and a queue.
|
void |
close()
Closes the channel and the connection with the server.
|
void |
openChannel()
Opens a new channel into the opened connection.
|
void |
publish(java.lang.String exchangeName,
java.lang.String routingKey,
RabbitMQMessage message)
Publishes a new message over an exchange.
|
public RabbitMQClient(java.lang.String serverHost, int serverPort, java.lang.String serverVirtualHost, java.lang.String serverUsername, java.lang.String serverPassword) throws java.io.IOException
RabbitMQClient
serverHost
- The server host.serverPort
- The server port.serverVirtualHost
- The virtual host into the RabbitMQ server.serverUsername
- The username to access the server.serverPassword
- The password to access the server.java.io.IOException
- It is thrown if there is some issue during the connection creation.public RabbitMQClient(java.lang.String uri) throws java.io.IOException
RabbitMQClient
uri
- The connection parameters in the form amqp://userName:password@hostName:portNumber/virtualHostjava.io.IOException
- It is thrown if there is some issue during the connection creation.public void openChannel() throws java.io.IOException
java.io.IOException
- It is thrown if there is some issue during the channel creation.public void bind(java.lang.String exchangeName, java.lang.String exchangeOptions, java.lang.String queueName, java.lang.String queueOptions, java.lang.String bindingKey, java.lang.String bindingArguments) throws java.io.IOException
exchangeName
- The exchange's name.exchangeOptions
- Options used when the exchange is created.
queueName
- The queue's name.queueOptions
- Options used when the queue is created.
bindingKey
- The routine key to use for the binding.bindingArguments
- This parameter is only used when the exchange's type is headers. In other cases is ignored.
java.io.IOException
- If there is some issue creating the relationship.public void publish(java.lang.String exchangeName, java.lang.String routingKey, RabbitMQMessage message) throws java.io.IOException
exchangeName
- The exchange's name where the message will be published.routingKey
- The routing key used to route the message in the exchange.message
- The message itself.java.io.IOException
- If there is some issue publishing the message.public void close() throws java.io.IOException
java.io.IOException
- If there is some issue trying to close the channel or connection.Copyright © 2019 The Apache Software Foundation