com.rabbitmq.client.Connection |
Known Indirect Subclasses |
Public API: Interface to an AMQ connection. See the see the spec for details.
To connect to a broker, fill in a ConnectionFactory
and use a ConnectionFactory
as follows:
ConnectionFactory factory = new ConnectionFactory(); factory.setHost(hostName); factory.setPort(portNumber); factory.setVirtualHost(virtualHost); factory.setUsername(username); factory.setPassword(password); Connection conn = factory.newConnection(); // Then open a channel: Channel channel = conn.createChannel();Or, more compactly:
ConnectionFactory factory = new ConnectionFactory(); factory.setUri("amqp://username:password@hostName:portNumber/virtualHost"); Connection conn = factory.newConnection(); Channel channel = conn.createChannel()Current implementations are thread-safe for code at the client API level, and in fact thread-safe internally except for code within RPC calls.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Abort this connection and all its channels
with the
com.rabbitmq.client.AMQP close code
and message 'OK'. | |||||||||||
Abort this connection and all its channels.
| |||||||||||
Abort this connection and all its channels.
| |||||||||||
Abort this connection and all its channels
with the
com.rabbitmq.client.AMQP close code
and message 'OK'. | |||||||||||
Close this connection and all its channels.
| |||||||||||
Close this connection and all its channels
with the
com.rabbitmq.client.AMQP close code
and message 'OK'. | |||||||||||
Close this connection and all its channels
with the
com.rabbitmq.client.AMQP close code
and message 'OK'. | |||||||||||
Close this connection and all its channels.
| |||||||||||
Create a new channel, using an internally allocated channel number.
| |||||||||||
Create a new channel, using the specified channel number if possible.
| |||||||||||
Retrieve the host.
| |||||||||||
Get the negotiated maximum channel number.
| |||||||||||
Get a copy of the map of client properties sent to the server
| |||||||||||
Get the negotiated maximum frame size.
| |||||||||||
Get the negotiated heartbeat interval.
| |||||||||||
Retrieve the port number.
| |||||||||||
Retrieve the server properties.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.rabbitmq.client.ShutdownNotifier
|
Abort this connection and all its channels
with the com.rabbitmq.client.AMQP
close code
and message 'OK'.
Forces the connection to close.
Any encountered exceptions in the close operations are silently discarded.
Abort this connection and all its channels. Forces the connection to close and waits with the given timeout for all the close operations to complete. When timeout is reached the socket is forced to close. Any encountered exceptions in the close operations are silently discarded.
closeCode | the close code (See under "Reply Codes" in the AMQP specification) |
---|---|
closeMessage | a message indicating the reason for closing the connection |
timeout | timeout (in milliseconds) for completing all the close-related operations, use -1 for infinity |
Abort this connection and all its channels. Forces the connection to close and waits for all the close operations to complete. Any encountered exceptions in the close operations are silently discarded.
closeCode | the close code (See under "Reply Codes" in the AMQP specification) |
---|---|
closeMessage | a message indicating the reason for closing the connection |
Abort this connection and all its channels
with the com.rabbitmq.client.AMQP
close code
and message 'OK'.
This method behaves in a similar way as abort()
, with the only difference
that it waits with a provided timeout for all the close operations to
complete. When timeout is reached the socket is forced to close.
timeout | timeout (in milliseconds) for completing all the close-related operations, use -1 for infinity |
---|
Close this connection and all its channels. Waits for all the close operations to complete.
closeCode | the close code (See under "Reply Codes" in the AMQP specification) |
---|---|
closeMessage | a message indicating the reason for closing the connection |
IOException | if an I/O problem is encountered |
---|
Close this connection and all its channels
with the com.rabbitmq.client.AMQP
close code
and message 'OK'.
Waits for all the close operations to complete.
IOException | if an I/O problem is encountered |
---|
Close this connection and all its channels
with the com.rabbitmq.client.AMQP
close code
and message 'OK'.
This method behaves in a similar way as close()
, with the only difference
that it waits with a provided timeout for all the close operations to
complete. When timeout is reached the socket is forced to close.
timeout | timeout (in milliseconds) for completing all the close-related operations, use -1 for infinity |
---|
IOException | if an I/O problem is encountered |
---|
Close this connection and all its channels. Waits with the given timeout for all the close operations to complete. When timeout is reached the socket is forced to close.
closeCode | the close code (See under "Reply Codes" in the AMQP specification) |
---|---|
closeMessage | a message indicating the reason for closing the connection |
timeout | timeout (in milliseconds) for completing all the close-related operations, use -1 for infinity |
IOException | if an I/O problem is encountered |
---|
Create a new channel, using an internally allocated channel number.
IOException | if an I/O problem is encountered |
---|
Create a new channel, using the specified channel number if possible.
channelNumber | the channel number to allocate |
---|
IOException | if an I/O problem is encountered |
---|
Retrieve the host.
Get the negotiated maximum channel number. Usable channel numbers range from 1 to this number, inclusive.
Get a copy of the map of client properties sent to the server
Get the negotiated maximum frame size.
Get the negotiated heartbeat interval.
Retrieve the port number.
Retrieve the server properties.