java.lang.Object
io.vertx.core.eventbus.DeliveryOptions
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
FieldsModifier and TypeFieldDescriptionstatic final booleanWhether the message should be delivered to local consumers only by default = false.static final longThe default send timeout.static final TracingPolicyDefault tracing control =TracingPolicy.PROPAGATE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorDeliveryOptions(DeliveryOptions other) Copy constructorDeliveryOptions(JsonObject json) Create a delivery options from JSON -
Method Summary
Modifier and TypeMethodDescriptionAdd a message header.Get the codec name.Get the message headerslongGet the send timeout.booleansetCodecName(String codecName) Set the codec name.setHeaders(MultiMap headers) Set message headers from a multi-map.setLocalOnly(boolean localOnly) Whether a message should be delivered to local consumers only.setSendTimeout(long timeout) Set the send timeout.setTracingPolicy(TracingPolicy tracingPolicy) Set the tracing policy when Vert.x has tracing enabled.toJson()Convert to JSON.
-
Field Details
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUTThe default send timeout.- See Also:
-
DEFAULT_LOCAL_ONLY
public static final boolean DEFAULT_LOCAL_ONLYWhether the message should be delivered to local consumers only by default = false.- See Also:
-
DEFAULT_TRACING_POLICY
Default tracing control =TracingPolicy.PROPAGATE
-
-
Constructor Details
-
DeliveryOptions
public DeliveryOptions()Default constructor -
DeliveryOptions
Copy constructor- Parameters:
other- the options to copy
-
DeliveryOptions
Create a delivery options from JSON- Parameters:
json- the JSON
-
-
Method Details
-
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
Set the send timeout.- Parameters:
timeout- the timeout value, in ms.- Returns:
- a reference to this, so the API can be used fluently
-
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
Set the codec name.- Parameters:
codecName- the codec name- Returns:
- a reference to this, so the API can be used fluently
-
addHeader
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
Set message headers from a multi-map.- Parameters:
headers- the headers- Returns:
- a reference to this, so the API can be used fluently
-
getHeaders
Get the message headers- Returns:
- the headers
-
isLocalOnly
public boolean isLocalOnly()- Returns:
- whether the message should be delivered to local consumers only
-
setLocalOnly
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
- Returns:
- the tracing policy
-
setTracingPolicy
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
-