Top Description Fields Constructors Methods
io.vertx.core.eventbus

public Class DeliveryOptions

extends Object
Class Inheritance
Annotations
@DataObject
Imports
io.vertx.codegen.annotations.DataObject, .GenIgnore, io.vertx.core.MultiMap, io.vertx.core.impl.Arguments, io.vertx.core.json.JsonObject, io.vertx.core.tracing.TracingPolicy, java.util.Map, .Objects

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

Modifier and TypeField and Description
private String
public static final boolean
DEFAULT_LOCAL_ONLY

Whether the message should be delivered to local consumers only by default = false.

public static final long
DEFAULT_TIMEOUT

The default send timeout.

public static final TracingPolicy
private MultiMap
private boolean
private long
private TracingPolicy

Constructor Summary

AccessConstructor and Description
public
DeliveryOptions()

Default constructor

public
DeliveryOptions(DeliveryOptions
the options to copy
other
)

Copy constructor

public
DeliveryOptions(JsonObject
the JSON
json
)
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Create a delivery options from JSON

Method Summary

Modifier and TypeMethod and Description
public DeliveryOptions

Returns:

a reference to this, so the API can be used fluently
addHeader
(String
the header key
key
,
String
the header value
value
)

Add a message header.

private void
public String

Returns:

the codec name
getCodecName
()

Get the codec name.

public MultiMap

Returns:

the headers
getHeaders
()

Get the message headers

public long

Returns:

the value of send timeout
getSendTimeout
()

Get the send timeout.

public TracingPolicy

Returns:

the tracing policy
getTracingPolicy
()

public boolean

Returns:

whether the message should be delivered to local consumers only
isLocalOnly
()

public DeliveryOptions

Returns:

a reference to this, so the API can be used fluently
setCodecName
(String
the codec name
codecName
)

Set the codec name.

public DeliveryOptions

Returns:

a reference to this, so the API can be used fluently
setHeaders
(MultiMap
the headers
headers
)

Set message headers from a multi-map.

public DeliveryOptions

Returns:

a reference to this, so the API can be used fluently
setLocalOnly
(boolean
true to deliver to local consumers only, false otherwise
localOnly
)

Whether a message should be delivered to local consumers only.

public DeliveryOptions

Returns:

a reference to this, so the API can be used fluently
setSendTimeout
(long
the timeout value, in ms.
timeout
)

Set the send timeout.

public DeliveryOptions

Returns:

a reference to this, so the API can be used fluently
setTracingPolicy
(TracingPolicy
the tracing policy
tracingPolicy
)

Set the tracing policy when Vert.x has tracing enabled.

public JsonObject

Returns:

the JSON
toJson
()
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Convert to JSON.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

codecNameback to summary
private String codecName
DEFAULT_LOCAL_ONLYback to summary
public static final boolean DEFAULT_LOCAL_ONLY

Whether the message should be delivered to local consumers only by default = false.

DEFAULT_TIMEOUTback to summary
public static final long DEFAULT_TIMEOUT

The default send timeout.

DEFAULT_TRACING_POLICYback to summary
public static final TracingPolicy DEFAULT_TRACING_POLICY

Default tracing control = TracingPolicy#PROPAGATE

headersback to summary
private MultiMap headers
localOnlyback to summary
private boolean localOnly
timeoutback to summary
private long timeout
tracingPolicyback to summary
private TracingPolicy tracingPolicy

Constructor Detail

DeliveryOptionsback to summary
public DeliveryOptions()

Default constructor

DeliveryOptionsback to summary
public DeliveryOptions(DeliveryOptions other)

Copy constructor

Parameters
other:DeliveryOptions

the options to copy

DeliveryOptionsback to summary
public DeliveryOptions(JsonObject json)

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a delivery options from JSON

Parameters
json:JsonObject

the JSON

Method Detail

addHeaderback to summary
public DeliveryOptions addHeader(String key, String value)

Add a message header.

Message headers can be sent with any message and will be accessible with io.vertx.core.eventbus.Message#headers at the recipient.

Parameters
key:String

the header key

value:String

the header value

Returns:DeliveryOptions

a reference to this, so the API can be used fluently

checkHeadersback to summary
private void checkHeaders()
getCodecNameback to summary
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:String

the codec name

getHeadersback to summary
public MultiMap getHeaders()

Get the message headers

Returns:MultiMap

the headers

Annotations
@GenIgnore
getSendTimeoutback to summary
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:long

the value of send timeout

getTracingPolicyback to summary
public TracingPolicy getTracingPolicy()
Returns:TracingPolicy

the tracing policy

isLocalOnlyback to summary
public boolean isLocalOnly()
Returns:boolean

whether the message should be delivered to local consumers only

setCodecNameback to summary
public DeliveryOptions setCodecName(String codecName)

Set the codec name.

Parameters
codecName:String

the codec name

Returns:DeliveryOptions

a reference to this, so the API can be used fluently

setHeadersback to summary
public DeliveryOptions setHeaders(MultiMap headers)

Set message headers from a multi-map.

Parameters
headers:MultiMap

the headers

Returns:DeliveryOptions

a reference to this, so the API can be used fluently

Annotations
@GenIgnore
setLocalOnlyback to summary
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:boolean

true to deliver to local consumers only, false otherwise

Returns:DeliveryOptions

a reference to this, so the API can be used fluently

setSendTimeoutback to summary
public DeliveryOptions setSendTimeout(long timeout)

Set the send timeout.

Parameters
timeout:long

the timeout value, in ms.

Returns:DeliveryOptions

a reference to this, so the API can be used fluently

setTracingPolicyback to summary
public DeliveryOptions setTracingPolicy(TracingPolicy tracingPolicy)

Set the tracing policy when Vert.x has tracing enabled.

Parameters
tracingPolicy:TracingPolicy

the tracing policy

Returns:DeliveryOptions

a reference to this, so the API can be used fluently

toJsonback to summary
public JsonObject toJson()

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Convert to JSON.

Returns:JsonObject

the JSON