|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Connection
Public API: Interface to an AMQ connection. See the see the spec for details.
To connect to a broker, fill in a ConnectionParameters and use a ConnectionFactory as follows:
ConnectionParameters params = new ConnectionParameters(); params.setUsername(userName); params.setPassword(password); params.setVirtualHost(virtualHost); params.setRequestedHeartbeat(0); ConnectionFactory factory = new ConnectionFactory(params); Connection conn = factory.newConnection(hostName, AMQP.PROTOCOL.PORT); // Then open a channel and retrieve an access ticket: Channel channel = conn.createChannel(); int ticket = channel.accessRequest(realmName);Current implementations are thread-safe for code at the client API level, and in fact thread-safe internally except for code within RPC calls.
| Method Summary | |
|---|---|
void |
close(int closeCode,
java.lang.String closeMessage)
Close this connection with the given code and message. |
Channel |
createChannel()
Create a new channel, using an internally allocated channel number. |
Channel |
createChannel(int channelNumber)
Create a new channel, using the specified channel number if possible. |
int |
getChannelMax()
Get the negotiated maximum number of channels allowed. |
int |
getFrameMax()
Get the negotiated maximum frame size. |
int |
getHeartbeat()
Get the negotiated heartbeat interval. |
java.lang.String |
getHost()
Retrieve the host. |
Address[] |
getKnownHosts()
Retrieve the known hosts. |
ConnectionParameters |
getParameters()
Retrieve the connection parameters. |
int |
getPort()
Retrieve the port number. |
| Method Detail |
|---|
java.lang.String getHost()
int getPort()
ConnectionParameters getParameters()
int getChannelMax()
getParameters().ConnectionParameters.getRequestedChannelMax().
int getFrameMax()
getParameters().ConnectionParameters.getRequestedFrameMax().
int getHeartbeat()
getParameters().ConnectionParameters.getRequestedHeartbeat().
Address[] getKnownHosts()
AMQP.Connection.OpenOk open-ok method
Channel createChannel()
throws java.io.IOException
java.io.IOException - if an I/O problem is encountered
Channel createChannel(int channelNumber)
throws java.io.IOException
channelNumber - the channel number to allocate
java.io.IOException - if an I/O problem is encountered
void close(int closeCode,
java.lang.String closeMessage)
throws java.io.IOException
closeCode - code indicating the reason for closing the connection - see AMQP spec for a list of codescloseMessage - optional message describing the reason for closing the connection
java.io.IOException - if an I/O problem is encountered
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||