public class RpcServer
extends java.lang.Object
Constructor and Description |
---|
RpcServer(Channel channel)
Creates an RpcServer listening on a temporary exclusive
autodelete queue.
|
RpcServer(Channel channel,
java.lang.String queueName)
If the passed-in queue name is null, creates a server-named
temporary exclusive autodelete queue to use; otherwise expects
the queue to have already been declared.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Public API - cancels the consumer, thus deleting the queue, if
it was a temporary queue, and marks the RpcServer as closed.
|
Channel |
getChannel()
Retrieve the channel.
|
java.lang.String |
getQueueName()
Retrieve the queue name.
|
byte[] |
handleCall(AMQP.BasicProperties requestProperties,
byte[] requestBody,
AMQP.BasicProperties replyProperties)
Mid-level response method.
|
byte[] |
handleCall(byte[] requestBody,
AMQP.BasicProperties replyProperties)
High-level response method.
|
byte[] |
handleCall(QueueingConsumer.Delivery request,
AMQP.BasicProperties replyProperties)
Lowest-level response method.
|
void |
handleCast(AMQP.BasicProperties requestProperties,
byte[] requestBody)
Mid-level handler method.
|
void |
handleCast(byte[] requestBody)
High-level handler method.
|
void |
handleCast(QueueingConsumer.Delivery request)
Lowest-level handler method.
|
ShutdownSignalException |
mainloop()
Public API - main server loop.
|
void |
processRequest(QueueingConsumer.Delivery request)
Private API - Process a single request.
|
protected QueueingConsumer |
setupConsumer()
Registers a consumer on the reply queue.
|
void |
terminateMainloop()
Call this method to terminate the mainloop.
|
public RpcServer(Channel channel) throws java.io.IOException
java.io.IOException
public RpcServer(Channel channel, java.lang.String queueName) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
- if an error is encounteredprotected QueueingConsumer setupConsumer() throws java.io.IOException
java.io.IOException
- if an error is encounteredpublic ShutdownSignalException mainloop() throws java.io.IOException
java.io.IOException
public void terminateMainloop()
public void processRequest(QueueingConsumer.Delivery request) throws java.io.IOException
java.io.IOException
public byte[] handleCall(QueueingConsumer.Delivery request, AMQP.BasicProperties replyProperties)
public byte[] handleCall(AMQP.BasicProperties requestProperties, byte[] requestBody, AMQP.BasicProperties replyProperties)
public byte[] handleCall(byte[] requestBody, AMQP.BasicProperties replyProperties)
public void handleCast(QueueingConsumer.Delivery request)
public void handleCast(AMQP.BasicProperties requestProperties, byte[] requestBody)
public void handleCast(byte[] requestBody)
public Channel getChannel()
public java.lang.String getQueueName()