io.vertx.core.eventbus

## Class DeliveryOptions

- java.lang.Object
- - io.vertx.core.eventbus.DeliveryOptions

-     public class DeliveryOptions
      extends Object

  Delivery options are used to configure message delivery.

  Delivery options allow to configure delivery timeout and message codec name, and to provide any headers that you wish to send with the message.

  Author:
    Tim Fox

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEFAULT_LOCAL_ONLY` Whether the message should be delivered to local consumers only by default = false.
    `static long` | `DEFAULT_TIMEOUT` The default send timeout.
    `static TracingPolicy` | `DEFAULT_TRACING_POLICY` Default tracing control = `TracingPolicy.PROPAGATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeliveryOptions()` Default constructor
    `DeliveryOptions(DeliveryOptions other)` Copy constructor
    `DeliveryOptions(JsonObject json)` Create a delivery options from JSON

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DeliveryOptions` | `addHeader(String key, String value)` Add a message header.
    `String` | `getCodecName()` Get the codec name.
    `MultiMap` | `getHeaders()` Get the message headers
    `long` | `getSendTimeout()` Get the send timeout.
    `TracingPolicy` | `getTracingPolicy()`
    `boolean` | `isLocalOnly()`
    `DeliveryOptions` | `setCodecName(String codecName)` Set the codec name.
    `DeliveryOptions` | `setHeaders(MultiMap headers)` Set message headers from a multi-map.
    `DeliveryOptions` | `setLocalOnly(boolean localOnly)` Whether a message should be delivered to local consumers only.
    `DeliveryOptions` | `setSendTimeout(long timeout)` Set the send timeout.
    `DeliveryOptions` | `setTracingPolicy(TracingPolicy tracingPolicy)` Set the tracing policy when Vert.x has tracing enabled.
    `JsonObject` | `toJson()` Convert to JSON.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_TIMEOUT

          public static final long DEFAULT_TIMEOUT

      The default send timeout.
      See Also:
        Constant Field Values

    - #### DEFAULT_LOCAL_ONLY

          public static final boolean DEFAULT_LOCAL_ONLY

      Whether the message should be delivered to local consumers only by default = false.
      See Also:
        Constant Field Values

    - #### DEFAULT_TRACING_POLICY

          public static final TracingPolicy DEFAULT_TRACING_POLICY

      Default tracing control = `TracingPolicy.PROPAGATE`

  - ### Constructor Detail

    - #### DeliveryOptions

          public DeliveryOptions()

      Default constructor

    - #### DeliveryOptions

          public DeliveryOptions(DeliveryOptions other)

      Copy constructor
      Parameters:
        `other` - the options to copy

    - #### DeliveryOptions

          public DeliveryOptions(JsonObject json)

      Create a delivery options from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Convert to JSON.
      Returns:
        the JSON

    - #### getSendTimeout

          public long getSendTimeout()

      Get the send timeout.

      When sending a message with a response handler a send timeout can be provided. If no response is received within the timeout the handler will be called with a failure.

      Returns:
        the value of send timeout

    - #### setSendTimeout

          public DeliveryOptions setSendTimeout(long timeout)

      Set the send timeout.
      Parameters:
        `timeout` - the timeout value, in ms.
      Returns:
        a reference to this, so the API can be used fluently

    - #### getCodecName

          public String getCodecName()

      Get the codec name.

      When sending or publishing a message a codec name can be provided. This must correspond with a previously registered message codec. This allows you to send arbitrary objects on the event bus (e.g. POJOs).

      Returns:
        the codec name

    - #### setCodecName

          public DeliveryOptions setCodecName(String codecName)

      Set the codec name.
      Parameters:
        `codecName` - the codec name
      Returns:
        a reference to this, so the API can be used fluently

    - #### addHeader

          public DeliveryOptions addHeader(String key,
                                           String value)

      Add a message header.

      Message headers can be sent with any message and will be accessible with `Message.headers()` at the recipient.

      Parameters:
        `key` - the header key
        `value` - the header value
      Returns:
        a reference to this, so the API can be used fluently

    - #### setHeaders

          public DeliveryOptions setHeaders(MultiMap headers)

      Set message headers from a multi-map.
      Parameters:
        `headers` - the headers
      Returns:
        a reference to this, so the API can be used fluently

    - #### getHeaders

          public MultiMap getHeaders()

      Get the message headers
      Returns:
        the headers

    - #### isLocalOnly

          public boolean isLocalOnly()

      Returns:
        whether the message should be delivered to local consumers only

    - #### setLocalOnly

          public DeliveryOptions setLocalOnly(boolean localOnly)

      Whether a message should be delivered to local consumers only. Defaults to `false`.

      This option is effective in clustered mode only and does not apply to reply messages.

      Parameters:
        `localOnly` - `true` to deliver to local consumers only, `false` otherwise
      Returns:
        a reference to this, so the API can be used fluently

    - #### getTracingPolicy

          public TracingPolicy getTracingPolicy()

      Returns:
        the tracing policy

    - #### setTracingPolicy

          public DeliveryOptions setTracingPolicy(TracingPolicy tracingPolicy)

      Set the tracing policy when Vert.x has tracing enabled.
      Parameters:
        `tracingPolicy` - the tracing policy
      Returns:
        a reference to this, so the API can be used fluently

Copyright © 2022 Eclipse. All rights reserved.