Package io.vertx.core.eventbus
Class DeliveryOptions
- java.lang.Object
-
- io.vertx.core.eventbus.DeliveryOptions
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_LOCAL_ONLYWhether the message should be delivered to local consumers only by default = false.static longDEFAULT_TIMEOUTThe default send timeout.static TracingPolicyDEFAULT_TRACING_POLICYDefault tracing control =TracingPolicy.PROPAGATE
-
Constructor Summary
Constructors Constructor Description DeliveryOptions()Default constructorDeliveryOptions(DeliveryOptions other)Copy constructorDeliveryOptions(JsonObject json)Create a delivery options from JSON
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeliveryOptionsaddHeader(String key, String value)Add a message header.StringgetCodecName()Get the codec name.MultiMapgetHeaders()Get the message headerslonggetSendTimeout()Get the send timeout.TracingPolicygetTracingPolicy()booleanisLocalOnly()DeliveryOptionssetCodecName(String codecName)Set the codec name.DeliveryOptionssetHeaders(MultiMap headers)Set message headers from a multi-map.DeliveryOptionssetLocalOnly(boolean localOnly)Whether a message should be delivered to local consumers only.DeliveryOptionssetSendTimeout(long timeout)Set the send timeout.DeliveryOptionssetTracingPolicy(TracingPolicy tracingPolicy)Set the tracing policy when Vert.x has tracing enabled.JsonObjecttoJson()Convert to JSON.
-
-
-
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 keyvalue- 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 tofalse.This option is effective in clustered mode only and does not apply to reply messages.
- Parameters:
localOnly-trueto deliver to local consumers only,falseotherwise- 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
-
-