Class RpcClientParams

java.lang.Object
com.rabbitmq.client.RpcClientParams

public class RpcClientParams extends Object
Holder class to configure a RpcClient.
Since:
5.6.0
See Also:
  • Constructor Details

    • RpcClientParams

      public RpcClientParams()
  • Method Details

    • getChannel

      public Channel getChannel()
      Set the channel to use for communication.
      Returns:
    • channel

      public RpcClientParams channel(Channel channel)
    • getExchange

      public String getExchange()
      Set the exchange to send requests to.
      Returns:
    • exchange

      public RpcClientParams exchange(String exchange)
    • getRoutingKey

      public String getRoutingKey()
    • routingKey

      public RpcClientParams routingKey(String routingKey)
      Set the routing key to use for requests.
      Parameters:
      routingKey -
      Returns:
    • getReplyTo

      public String getReplyTo()
    • replyTo

      public RpcClientParams replyTo(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 UnroutableRpcRequestException exceptions thrown. Use a custom reply handler to change this behavior.

      Parameters:
      useMandatory -
      Returns:
      See Also:
    • useMandatory

      public RpcClientParams 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

      public RpcClientParams correlationIdSupplier(Supplier<String> correlationIdGenerator)
      Logic to generate correlation IDs.
      Parameters:
      correlationIdGenerator -
      Returns:
      Since:
      5.9.0
    • getCorrelationIdSupplier

      public Supplier<String> getCorrelationIdSupplier()
    • getReplyHandler

      public Function<Object,RpcClient.Response> getReplyHandler()
    • replyHandler

      public RpcClientParams replyHandler(Function<Object,RpcClient.Response> 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 in UnroutableRpcRequestException exceptions.

      Parameters:
      replyHandler -
      Returns:
      See Also: