public class RpcServer extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
RpcServer.RpcConsumer |
Constructor and Description |
---|
RpcServer(Channel channel)
Creates an RpcServer listening on a temporary exclusive
autodelete queue.
|
RpcServer(Channel channel,
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.
|
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(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(Delivery request)
Lowest-level handler method.
|
ShutdownSignalException |
mainloop()
Public API - main server loop.
|
protected AMQP.BasicProperties |
postprocessReplyProperties(Delivery request,
AMQP.BasicProperties.Builder builder)
Gives a chance to set/modify reply properties after the handling call
|
protected AMQP.BasicProperties |
preprocessReplyProperties(Delivery request,
AMQP.BasicProperties.Builder builder)
Gives a chance to set/modify reply properties before handling call.
|
void |
processRequest(Delivery request)
Private API - Process a single request.
|
protected RpcServer.RpcConsumer |
setupConsumer()
Registers a consumer on the reply queue.
|
void |
terminateMainloop()
Call this method to terminate the mainloop.
|
public RpcServer(Channel channel) throws IOException
IOException
public RpcServer(Channel channel, String queueName) throws IOException
IOException
public void close() throws IOException
IOException
- if an error is encounteredprotected RpcServer.RpcConsumer setupConsumer() throws IOException
IOException
- if an error is encounteredpublic ShutdownSignalException mainloop() throws IOException
IOException
public void terminateMainloop()
public void processRequest(Delivery request) throws IOException
IOException
public byte[] handleCall(Delivery request, AMQP.BasicProperties replyProperties)
public byte[] handleCall(AMQP.BasicProperties requestProperties, byte[] requestBody, AMQP.BasicProperties replyProperties)
public byte[] handleCall(byte[] requestBody, AMQP.BasicProperties replyProperties)
protected AMQP.BasicProperties preprocessReplyProperties(Delivery request, AMQP.BasicProperties.Builder builder)
request
- the inbound messagebuilder
- the reply properties builderprotected AMQP.BasicProperties postprocessReplyProperties(Delivery request, AMQP.BasicProperties.Builder builder)
request
- the inbound messagebuilder
- the reply properties builderpublic void handleCast(Delivery request)
public void handleCast(AMQP.BasicProperties requestProperties, byte[] requestBody)
public void handleCast(byte[] requestBody)
public Channel getChannel()
public String getQueueName()
Copyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.