Class PreparedQueryDefinition
java.lang.Object
io.vertx.ext.consul.PreparedQueryDefinition
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorConstructor from JSON -
Method Summary
Modifier and TypeMethodDescriptiongetDcs()Specifies a fixed list of remote datacenters to forward the query to if there are no healthy nodes in the local datacenter.Get the TTL duration when query results are served over DNS.getId()Get ID of the querygetMeta()Get a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.getName()Get an optional friendly name that can be used to execute a query instead of using its IDintSpecifies that the query will be forwarded to up to NearestN other datacenters based on their estimated network round trip time using Network Coordinates from the WAN gossip pool.booleanSpecifies the behavior of the query's health check filtering.Get the name of the service to queryGet the ID of an existing session.getTags()Get a list of service tags to filter the query results.Get regular expression which is used to extract fields from the entire name, once this template is selected.The template type, which must bename_prefix_match.getToken()Get the ACL token to use each time the query is executed.Specifies a fixed list of remote datacenters to forward the query to if there are no healthy nodes in the local datacenter.Set the TTL duration when query results are served over DNS.Set ID of the query, always generated by ConsulSet a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.Set an optional friendly name that can be used to execute a query instead of using its IDsetNearestN(int nearestN) Specifies that the query will be forwarded to up to NearestN other datacenters based on their estimated network round trip time using Network Coordinates from the WAN gossip pool.setPassing(boolean passing) Specifies the behavior of the query's health check filtering.setService(String service) Set the name of the service to querysetSession(String session) Set the ID of an existing session.Set a list of service tags to filter the query results.setTemplateRegexp(String templateRegexp) Set regular expression which is used to extract fields from the entire name, once this template is selected.setTemplateType(String templateType) The template type, which must bename_prefix_match.Set the ACL token to use each time the query is executed.toJson()Convert to JSON
-
Constructor Details
-
PreparedQueryDefinition
public PreparedQueryDefinition()Default constructor -
PreparedQueryDefinition
-
-
Method Details
-
toJson
-
getId
-
setId
Set ID of the query, always generated by Consul- Parameters:
id- ID of the query- Returns:
- reference to this, for fluency
-
getName
Get an optional friendly name that can be used to execute a query instead of using its ID- Returns:
- name of the query
-
setName
Set an optional friendly name that can be used to execute a query instead of using its ID- Parameters:
name- name of the query- Returns:
- reference to this, for fluency
-
getSession
Get the ID of an existing session. This provides a way to automatically remove a prepared query when the given session is invalidated. If not given the prepared query must be manually removed when no longer needed.- Returns:
- id of session
-
setSession
Set the ID of an existing session. This provides a way to automatically remove a prepared query when the given session is invalidated. If not given the prepared query must be manually removed when no longer needed.- Parameters:
session- id of session- Returns:
- reference to this, for fluency
-
getService
-
setService
Set the name of the service to query- Parameters:
service- service name- Returns:
- reference to this, for fluency
-
getToken
Get the ACL token to use each time the query is executed. This allows queries to be executed by clients with lesser or even no ACL Token, so this should be used with care.- Returns:
- the ACL token
-
setToken
Set the ACL token to use each time the query is executed. This allows queries to be executed by clients with lesser or even no ACL Token, so this should be used with care.- Parameters:
token- the ACL token- Returns:
- reference to this, for fluency
-
getDnsTtl
Get the TTL duration when query results are served over DNS. If this is specified, it will take precedence over any Consul agent-specific configuration.- Returns:
- the TTL duration
-
setDnsTtl
Set the TTL duration when query results are served over DNS. If this is specified, it will take precedence over any Consul agent-specific configuration.- Parameters:
dnsTtl- the TTL duration- Returns:
- reference to this, for fluency
-
getNearestN
public int getNearestN()Specifies that the query will be forwarded to up to NearestN other datacenters based on their estimated network round trip time using Network Coordinates from the WAN gossip pool. The median round trip time from the server handling the query to the servers in the remote datacenter is used to determine the priority.- Returns:
- number of nearest datacenters to query
-
setNearestN
Specifies that the query will be forwarded to up to NearestN other datacenters based on their estimated network round trip time using Network Coordinates from the WAN gossip pool. The median round trip time from the server handling the query to the servers in the remote datacenter is used to determine the priority.- Parameters:
nearestN- number of nearest datacenters to query- Returns:
- reference to this, for fluency
-
getDcs
Specifies a fixed list of remote datacenters to forward the query to if there are no healthy nodes in the local datacenter. Datacenters are queried in the order given in the list. If this option is combined with NearestN, then the NearestN queries will be performed first, followed by the list given by Datacenters. A given datacenter will only be queried one time during a failover, even if it is selected by both NearestN and is listed in Datacenters.- Returns:
- the list of remote datacenters
-
setDcs
Specifies a fixed list of remote datacenters to forward the query to if there are no healthy nodes in the local datacenter. Datacenters are queried in the order given in the list. If this option is combined with NearestN, then the NearestN queries will be performed first, followed by the list given by Datacenters. A given datacenter will only be queried one time during a failover, even if it is selected by both NearestN and is listed in Datacenters.- Parameters:
dcs- the list of remote datacenters- Returns:
- reference to this, for fluency
-
getTags
-
setTags
Set a list of service tags to filter the query results. For a service to pass the tag filter it must have all of the required tags, and none of the excluded tags (prefixed with `!`).- Parameters:
tags- list of service tags- Returns:
- reference to this, for fluency
-
getPassing
public boolean getPassing()Specifies the behavior of the query's health check filtering. If this is set to false, the results will include nodes with checks in the passing as well as the warning states. If this is set to true, only nodes with checks in the passing state will be returned.- Returns:
- the passing flag
-
setPassing
Specifies the behavior of the query's health check filtering. If this is set to false, the results will include nodes with checks in the passing as well as the warning states. If this is set to true, only nodes with checks in the passing state will be returned.- Parameters:
passing- the passing flag- Returns:
- reference to this, for fluency
-
getMeta
-
setMeta
Set a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.- Parameters:
meta- list of key/value pairs- Returns:
- reference to this, for fluency
-
getTemplateType
The template type, which must bename_prefix_match. This means that the template will apply to any query lookup with a name whose prefix matches the Name field of the template.- Returns:
- the query type
- See Also:
-
setTemplateType
The template type, which must bename_prefix_match. This means that the template will apply to any query lookup with a name whose prefix matches the Name field of the template.- Parameters:
templateType- the query type- Returns:
- reference to this, for fluency
- See Also:
-
getTemplateRegexp
Get regular expression which is used to extract fields from the entire name, once this template is selected.- Returns:
- a regular expression
- See Also:
-
setTemplateRegexp
Set regular expression which is used to extract fields from the entire name, once this template is selected.- Parameters:
templateRegexp- a regular expression- Returns:
- reference to this, for fluency
- See Also:
-