Package com.rabbitmq.client
Class RpcClientParams
- java.lang.Object
-
- com.rabbitmq.client.RpcClientParams
-
public class RpcClientParams extends java.lang.ObjectHolder class to configure aRpcClient.- Since:
- 5.6.0
- See Also:
RpcClient(RpcClientParams)
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelchannelChannel we are communicating onprivate java.util.function.Supplier<java.lang.String>correlationIdSupplierLogic to generate correlation IDs.private java.lang.StringexchangeExchange to send requests toprivate java.util.function.Function<java.lang.Object,RpcClient.Response>replyHandlerBehavior to handle reply messages.private java.lang.StringreplyToQueue where the server should put the replyprivate java.lang.StringroutingKeyRouting key to use for requestsprivate inttimeoutTimeout in milliseconds to use on call responsesprivate booleanuseMandatoryWhether to publish RPC requests with the mandatory flag or not.
-
Constructor Summary
Constructors Constructor Description RpcClientParams()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RpcClientParamschannel(Channel channel)RpcClientParamscorrelationIdSupplier(java.util.function.Supplier<java.lang.String> correlationIdGenerator)Logic to generate correlation IDs.RpcClientParamsexchange(java.lang.String exchange)ChannelgetChannel()Set the channel to use for communication.java.util.function.Supplier<java.lang.String>getCorrelationIdSupplier()java.lang.StringgetExchange()Set the exchange to send requests to.java.util.function.Function<java.lang.Object,RpcClient.Response>getReplyHandler()java.lang.StringgetReplyTo()java.lang.StringgetRoutingKey()intgetTimeout()RpcClientParamsreplyHandler(java.util.function.Function<java.lang.Object,RpcClient.Response> replyHandler)Set the behavior to use when receiving replies.RpcClientParamsreplyTo(java.lang.String replyTo)Set the queue where the server should put replies on.RpcClientParamsroutingKey(java.lang.String routingKey)Set the routing key to use for requests.booleanshouldUseMandatory()RpcClientParamstimeout(int timeout)Set the timeout in milliseconds to use on call responses.RpcClientParamsuseMandatory()Instructs to use the mandatory flag when publishing RPC requests.RpcClientParamsuseMandatory(boolean useMandatory)Whether to publish RPC requests with the mandatory flag or not.
-
-
-
Field Detail
-
channel
private Channel channel
Channel we are communicating on
-
exchange
private java.lang.String exchange
Exchange to send requests to
-
routingKey
private java.lang.String routingKey
Routing key to use for requests
-
replyTo
private java.lang.String replyTo
Queue where the server should put the reply
-
timeout
private int timeout
Timeout in milliseconds to use on call responses
-
useMandatory
private boolean useMandatory
Whether to publish RPC requests with the mandatory flag or not.
-
replyHandler
private java.util.function.Function<java.lang.Object,RpcClient.Response> replyHandler
Behavior to handle reply messages.
-
correlationIdSupplier
private java.util.function.Supplier<java.lang.String> correlationIdSupplier
Logic to generate correlation IDs.
-
-
Method Detail
-
getChannel
public Channel getChannel()
Set the channel to use for communication.- Returns:
-
channel
public RpcClientParams channel(Channel channel)
-
getExchange
public java.lang.String getExchange()
Set the exchange to send requests to.- Returns:
-
exchange
public RpcClientParams exchange(java.lang.String exchange)
-
getRoutingKey
public java.lang.String getRoutingKey()
-
routingKey
public RpcClientParams routingKey(java.lang.String routingKey)
Set the routing key to use for requests.- Parameters:
routingKey-- Returns:
-
getReplyTo
public java.lang.String getReplyTo()
-
replyTo
public RpcClientParams replyTo(java.lang.String 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
public RpcClientParams timeout(int timeout)
Set the timeout in milliseconds to use on call responses.- Parameters:
timeout-- Returns:
-
useMandatory
public RpcClientParams useMandatory(boolean 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
UnroutableRpcRequestExceptionexceptions thrown. Use a custom reply handler to change this behavior.- Parameters:
useMandatory-- Returns:
- See Also:
replyHandler(Function)
-
useMandatory
public RpcClientParams useMandatory()
Instructs to use the mandatory flag when publishing RPC requests.Unroutable requests will result in
UnroutableRpcRequestExceptionexceptions thrown. Use a custom reply handler to change this behavior.- Returns:
- See Also:
replyHandler(Function)
-
shouldUseMandatory
public boolean shouldUseMandatory()
-
correlationIdSupplier
public RpcClientParams correlationIdSupplier(java.util.function.Supplier<java.lang.String> correlationIdGenerator)
Logic to generate correlation IDs.- Parameters:
correlationIdGenerator-- Returns:
- Since:
- 5.9.0
-
getCorrelationIdSupplier
public java.util.function.Supplier<java.lang.String> getCorrelationIdSupplier()
-
getReplyHandler
public java.util.function.Function<java.lang.Object,RpcClient.Response> getReplyHandler()
-
replyHandler
public RpcClientParams replyHandler(java.util.function.Function<java.lang.Object,RpcClient.Response> replyHandler)
Set the behavior to use when receiving replies.The default is to wrap the reply into a
RpcClient.Responseinstance. Unroutable requests will result inUnroutableRpcRequestExceptionexceptions.- Parameters:
replyHandler-- Returns:
- See Also:
useMandatory(),useMandatory(boolean)
-
-