Package com.rabbitmq.client
Class RpcClientParams
java.lang.Object
com.rabbitmq.client.RpcClientParams
Holder class to configure a
RpcClient
.- Since:
- 5.6.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Channel
Channel we are communicating onLogic to generate correlation IDs.private String
Exchange to send requests toprivate Function
<Object, RpcClient.Response> Behavior to handle reply messages.private String
Queue where the server should put the replyprivate String
Routing key to use for requestsprivate int
Timeout in milliseconds to use on call responsesprivate boolean
Whether to publish RPC requests with the mandatory flag or not. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncorrelationIdSupplier
(Supplier<String> correlationIdGenerator) Logic to generate correlation IDs.Set the channel to use for communication.Set the exchange to send requests to.int
replyHandler
(Function<Object, RpcClient.Response> replyHandler) Set the behavior to use when receiving replies.Set the queue where the server should put replies on.routingKey
(String routingKey) Set the routing key to use for requests.boolean
timeout
(int timeout) Set the timeout in milliseconds to use on call responses.Instructs to use the mandatory flag when publishing RPC requests.useMandatory
(boolean useMandatory) Whether to publish RPC requests with the mandatory flag or not.
-
Field Details
-
channel
Channel we are communicating on -
exchange
Exchange to send requests to -
routingKey
Routing key to use for requests -
replyTo
Queue where the server should put the reply -
timeout
private int timeoutTimeout in milliseconds to use on call responses -
useMandatory
private boolean useMandatoryWhether to publish RPC requests with the mandatory flag or not. -
replyHandler
Behavior to handle reply messages. -
correlationIdSupplier
Logic to generate correlation IDs.
-
-
Constructor Details
-
RpcClientParams
public RpcClientParams()
-
-
Method Details
-
getChannel
Set the channel to use for communication.- Returns:
-
channel
-
getExchange
Set the exchange to send requests to.- Returns:
-
exchange
-
getRoutingKey
-
routingKey
Set the routing key to use for requests.- Parameters:
routingKey
-- Returns:
-
getReplyTo
-
replyTo
Set the queue where the server should put replies on.The default is to use Direct Reply-to. Using another value will cause the creation of a temporary private auto-delete queue.
The default shouldn't be changed for performance reasons.
- Parameters:
replyTo
-- Returns:
-
getTimeout
public int getTimeout() -
timeout
Set the timeout in milliseconds to use on call responses.- Parameters:
timeout
-- Returns:
-
useMandatory
Whether to publish RPC requests with the mandatory flag or not.Default is to not publish requests with the mandatory flag set to true.
When set to true, unroutable requests will result in
UnroutableRpcRequestException
exceptions thrown. Use a custom reply handler to change this behavior.- Parameters:
useMandatory
-- Returns:
- See Also:
-
useMandatory
Instructs to use the mandatory flag when publishing RPC requests.Unroutable requests will result in
UnroutableRpcRequestException
exceptions thrown. Use a custom reply handler to change this behavior.- Returns:
- See Also:
-
shouldUseMandatory
public boolean shouldUseMandatory() -
correlationIdSupplier
Logic to generate correlation IDs.- Parameters:
correlationIdGenerator
-- Returns:
- Since:
- 5.9.0
-
getCorrelationIdSupplier
-
getReplyHandler
-
replyHandler
Set the behavior to use when receiving replies.The default is to wrap the reply into a
RpcClient.Response
instance. Unroutable requests will result inUnroutableRpcRequestException
exceptions.- Parameters:
replyHandler
-- Returns:
- See Also:
-