
com.indeed.rabbitmq.admin.pojo.Definition Maven / Gradle / Ivy
package com.indeed.rabbitmq.admin.pojo;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* The definitions to apply to a RabbitMQ policy.
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"alternate-exchange",
"dead-letter-exchange",
"dead-letter-routing-key",
"expires",
"ha-mode",
"ha-params",
"ha-promote-on-shutdown",
"ha-sync-batch-size",
"ha-sync-mode",
"max-length",
"max-length-bytes",
"message-ttl",
"queue-master-locator"
})
public class Definition {
/**
* If an exchange cannot route a message to any queue, that message is
* rerouted to the alternate exchange for routing.
* Applied to exchanges.
*
*/
@JsonProperty("alternate-exchange")
@JsonPropertyDescription("If an exchange cannot route a message to any queue, that message is\nrerouted to the alternate exchange for routing.\nApplied to exchanges.")
private String alternateExchange;
/**
* Route dead letter messages to this exchange.
*
* Messages are considered dead if the message expires, it is rejected (via
* nack) or if a queue length limit would be exceeded.
* Applied to queues.
*
*/
@JsonProperty("dead-letter-exchange")
@JsonPropertyDescription("Messages are considered dead if the message expires, it is rejected (via\nnack) or if a queue length limit would be exceeded.\nApplied to queues.")
private String deadLetterExchange;
/**
* Modify the routing key of dead letter messages to this value.
* Applied to queues.
*
*/
@JsonProperty("dead-letter-routing-key")
@JsonPropertyDescription("Modify the routing key of dead letter messages to this value.\nApplied to queues.")
private String deadLetterRoutingKey;
/**
* Remove queue if it remains unused for this number of milliseconds.
* Applied to queues.
*
*/
@JsonProperty("expires")
@JsonPropertyDescription("Remove queue if it remains unused for this number of milliseconds.\nApplied to queues.")
private Long expires;
/**
* Indicates the nodes to which high availability queues are synchronized.
*
*/
@JsonProperty("ha-mode")
@JsonPropertyDescription("Indicates the nodes to which high availability queues are synchronized.")
private Definition.HaMode haMode;
/**
* Indicates the nodes to which high availability queues are synchronized.
*
*/
@JsonProperty("ha-params")
@JsonPropertyDescription("Indicates the nodes to which high availability queues are synchronized.")
private Long haParams;
/**
* Set to "always" to prefer that master nodes fail over to
* unsynchronized slaves in all circumstances (i.e., availability over
* message lost avoidance).
* Applied to queues.
*
*/
@JsonProperty("ha-promote-on-shutdown")
@JsonPropertyDescription("Set to \"always\" to prefer that master nodes fail over to\nunsynchronized slaves in all circumstances (i.e., availability over\nmessage lost avoidance).\nApplied to queues.")
private Definition.HaPromoteOnShutdown haPromoteOnShutdown;
/**
* If queue is automatically synchronized then this argument indicates
* the number of messages for batch synchronization.
* Applied to queues.
*
*/
@JsonProperty("ha-sync-batch-size")
@JsonPropertyDescription("If queue is automatically synchronized then this argument indicates\nthe number of messages for batch synchronization.\nApplied to queues.")
private Long haSyncBatchSize;
/**
* Indicates how queue synchronization is controlled.
* If "manual" then the queue must be synchronized via this admin API.
* Applied to queues.
*
*/
@JsonProperty("ha-sync-mode")
@JsonPropertyDescription("Indicates how queue synchronization is controlled.\nIf \"manual\" then the queue must be synchronized via this admin API.\nApplied to queues.")
private Definition.HaSyncMode haSyncMode;
/**
* Maximum number of messages in a queue.
* Applied to queues.
*
*/
@JsonProperty("max-length")
@JsonPropertyDescription("Maximum number of messages in a queue.\nApplied to queues.")
private Long maxLength;
/**
* Maximum number of bytes in a queue.
* Applied to queues.
*
*/
@JsonProperty("max-length-bytes")
@JsonPropertyDescription("Maximum number of bytes in a queue.\nApplied to queues.")
private Long maxLengthBytes;
/**
* Remove message if it remains in the queue for this number of milliseconds.
*
* Sets the TTL on messages in a queue. Policy must be attached to a queue.
* These messages are routed as dead letter messages after expiration.
* Applied to queues.
*
*/
@JsonProperty("message-ttl")
@JsonPropertyDescription("Sets the TTL on messages in a queue. Policy must be attached to a queue.\nThese messages are routed as dead letter messages after expiration.\nApplied to queues.")
private Long messageTtl;
/**
* Indicates how to elect the queue home node.
* Applied to queues.
*
*/
@JsonProperty("queue-master-locator")
@JsonPropertyDescription("Indicates how to elect the queue home node.\nApplied to queues.")
private Definition.QueueMasterLocator queueMasterLocator;
@JsonIgnore
private Map additionalProperties = new HashMap();
/**
* If an exchange cannot route a message to any queue, that message is
* rerouted to the alternate exchange for routing.
* Applied to exchanges.
*
*/
@JsonProperty("alternate-exchange")
public String getAlternateExchange() {
return alternateExchange;
}
/**
* If an exchange cannot route a message to any queue, that message is
* rerouted to the alternate exchange for routing.
* Applied to exchanges.
*
*/
@JsonProperty("alternate-exchange")
public void setAlternateExchange(String alternateExchange) {
this.alternateExchange = alternateExchange;
}
public Definition withAlternateExchange(String alternateExchange) {
this.alternateExchange = alternateExchange;
return this;
}
/**
* Route dead letter messages to this exchange.
*
* Messages are considered dead if the message expires, it is rejected (via
* nack) or if a queue length limit would be exceeded.
* Applied to queues.
*
*/
@JsonProperty("dead-letter-exchange")
public String getDeadLetterExchange() {
return deadLetterExchange;
}
/**
* Route dead letter messages to this exchange.
*
* Messages are considered dead if the message expires, it is rejected (via
* nack) or if a queue length limit would be exceeded.
* Applied to queues.
*
*/
@JsonProperty("dead-letter-exchange")
public void setDeadLetterExchange(String deadLetterExchange) {
this.deadLetterExchange = deadLetterExchange;
}
public Definition withDeadLetterExchange(String deadLetterExchange) {
this.deadLetterExchange = deadLetterExchange;
return this;
}
/**
* Modify the routing key of dead letter messages to this value.
* Applied to queues.
*
*/
@JsonProperty("dead-letter-routing-key")
public String getDeadLetterRoutingKey() {
return deadLetterRoutingKey;
}
/**
* Modify the routing key of dead letter messages to this value.
* Applied to queues.
*
*/
@JsonProperty("dead-letter-routing-key")
public void setDeadLetterRoutingKey(String deadLetterRoutingKey) {
this.deadLetterRoutingKey = deadLetterRoutingKey;
}
public Definition withDeadLetterRoutingKey(String deadLetterRoutingKey) {
this.deadLetterRoutingKey = deadLetterRoutingKey;
return this;
}
/**
* Remove queue if it remains unused for this number of milliseconds.
* Applied to queues.
*
*/
@JsonProperty("expires")
public Long getExpires() {
return expires;
}
/**
* Remove queue if it remains unused for this number of milliseconds.
* Applied to queues.
*
*/
@JsonProperty("expires")
public void setExpires(Long expires) {
this.expires = expires;
}
public Definition withExpires(Long expires) {
this.expires = expires;
return this;
}
/**
* Indicates the nodes to which high availability queues are synchronized.
*
*/
@JsonProperty("ha-mode")
public Definition.HaMode getHaMode() {
return haMode;
}
/**
* Indicates the nodes to which high availability queues are synchronized.
*
*/
@JsonProperty("ha-mode")
public void setHaMode(Definition.HaMode haMode) {
this.haMode = haMode;
}
public Definition withHaMode(Definition.HaMode haMode) {
this.haMode = haMode;
return this;
}
/**
* Indicates the nodes to which high availability queues are synchronized.
*
*/
@JsonProperty("ha-params")
public Long getHaParams() {
return haParams;
}
/**
* Indicates the nodes to which high availability queues are synchronized.
*
*/
@JsonProperty("ha-params")
public void setHaParams(Long haParams) {
this.haParams = haParams;
}
public Definition withHaParams(Long haParams) {
this.haParams = haParams;
return this;
}
/**
* Set to "always" to prefer that master nodes fail over to
* unsynchronized slaves in all circumstances (i.e., availability over
* message lost avoidance).
* Applied to queues.
*
*/
@JsonProperty("ha-promote-on-shutdown")
public Definition.HaPromoteOnShutdown getHaPromoteOnShutdown() {
return haPromoteOnShutdown;
}
/**
* Set to "always" to prefer that master nodes fail over to
* unsynchronized slaves in all circumstances (i.e., availability over
* message lost avoidance).
* Applied to queues.
*
*/
@JsonProperty("ha-promote-on-shutdown")
public void setHaPromoteOnShutdown(Definition.HaPromoteOnShutdown haPromoteOnShutdown) {
this.haPromoteOnShutdown = haPromoteOnShutdown;
}
public Definition withHaPromoteOnShutdown(Definition.HaPromoteOnShutdown haPromoteOnShutdown) {
this.haPromoteOnShutdown = haPromoteOnShutdown;
return this;
}
/**
* If queue is automatically synchronized then this argument indicates
* the number of messages for batch synchronization.
* Applied to queues.
*
*/
@JsonProperty("ha-sync-batch-size")
public Long getHaSyncBatchSize() {
return haSyncBatchSize;
}
/**
* If queue is automatically synchronized then this argument indicates
* the number of messages for batch synchronization.
* Applied to queues.
*
*/
@JsonProperty("ha-sync-batch-size")
public void setHaSyncBatchSize(Long haSyncBatchSize) {
this.haSyncBatchSize = haSyncBatchSize;
}
public Definition withHaSyncBatchSize(Long haSyncBatchSize) {
this.haSyncBatchSize = haSyncBatchSize;
return this;
}
/**
* Indicates how queue synchronization is controlled.
* If "manual" then the queue must be synchronized via this admin API.
* Applied to queues.
*
*/
@JsonProperty("ha-sync-mode")
public Definition.HaSyncMode getHaSyncMode() {
return haSyncMode;
}
/**
* Indicates how queue synchronization is controlled.
* If "manual" then the queue must be synchronized via this admin API.
* Applied to queues.
*
*/
@JsonProperty("ha-sync-mode")
public void setHaSyncMode(Definition.HaSyncMode haSyncMode) {
this.haSyncMode = haSyncMode;
}
public Definition withHaSyncMode(Definition.HaSyncMode haSyncMode) {
this.haSyncMode = haSyncMode;
return this;
}
/**
* Maximum number of messages in a queue.
* Applied to queues.
*
*/
@JsonProperty("max-length")
public Long getMaxLength() {
return maxLength;
}
/**
* Maximum number of messages in a queue.
* Applied to queues.
*
*/
@JsonProperty("max-length")
public void setMaxLength(Long maxLength) {
this.maxLength = maxLength;
}
public Definition withMaxLength(Long maxLength) {
this.maxLength = maxLength;
return this;
}
/**
* Maximum number of bytes in a queue.
* Applied to queues.
*
*/
@JsonProperty("max-length-bytes")
public Long getMaxLengthBytes() {
return maxLengthBytes;
}
/**
* Maximum number of bytes in a queue.
* Applied to queues.
*
*/
@JsonProperty("max-length-bytes")
public void setMaxLengthBytes(Long maxLengthBytes) {
this.maxLengthBytes = maxLengthBytes;
}
public Definition withMaxLengthBytes(Long maxLengthBytes) {
this.maxLengthBytes = maxLengthBytes;
return this;
}
/**
* Remove message if it remains in the queue for this number of milliseconds.
*
* Sets the TTL on messages in a queue. Policy must be attached to a queue.
* These messages are routed as dead letter messages after expiration.
* Applied to queues.
*
*/
@JsonProperty("message-ttl")
public Long getMessageTtl() {
return messageTtl;
}
/**
* Remove message if it remains in the queue for this number of milliseconds.
*
* Sets the TTL on messages in a queue. Policy must be attached to a queue.
* These messages are routed as dead letter messages after expiration.
* Applied to queues.
*
*/
@JsonProperty("message-ttl")
public void setMessageTtl(Long messageTtl) {
this.messageTtl = messageTtl;
}
public Definition withMessageTtl(Long messageTtl) {
this.messageTtl = messageTtl;
return this;
}
/**
* Indicates how to elect the queue home node.
* Applied to queues.
*
*/
@JsonProperty("queue-master-locator")
public Definition.QueueMasterLocator getQueueMasterLocator() {
return queueMasterLocator;
}
/**
* Indicates how to elect the queue home node.
* Applied to queues.
*
*/
@JsonProperty("queue-master-locator")
public void setQueueMasterLocator(Definition.QueueMasterLocator queueMasterLocator) {
this.queueMasterLocator = queueMasterLocator;
}
public Definition withQueueMasterLocator(Definition.QueueMasterLocator queueMasterLocator) {
this.queueMasterLocator = queueMasterLocator;
return this;
}
@JsonAnyGetter
public Map getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
public Definition withAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(Definition.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("alternateExchange");
sb.append('=');
sb.append(((this.alternateExchange == null)?"":this.alternateExchange));
sb.append(',');
sb.append("deadLetterExchange");
sb.append('=');
sb.append(((this.deadLetterExchange == null)?"":this.deadLetterExchange));
sb.append(',');
sb.append("deadLetterRoutingKey");
sb.append('=');
sb.append(((this.deadLetterRoutingKey == null)?"":this.deadLetterRoutingKey));
sb.append(',');
sb.append("expires");
sb.append('=');
sb.append(((this.expires == null)?"":this.expires));
sb.append(',');
sb.append("haMode");
sb.append('=');
sb.append(((this.haMode == null)?"":this.haMode));
sb.append(',');
sb.append("haParams");
sb.append('=');
sb.append(((this.haParams == null)?"":this.haParams));
sb.append(',');
sb.append("haPromoteOnShutdown");
sb.append('=');
sb.append(((this.haPromoteOnShutdown == null)?"":this.haPromoteOnShutdown));
sb.append(',');
sb.append("haSyncBatchSize");
sb.append('=');
sb.append(((this.haSyncBatchSize == null)?"":this.haSyncBatchSize));
sb.append(',');
sb.append("haSyncMode");
sb.append('=');
sb.append(((this.haSyncMode == null)?"":this.haSyncMode));
sb.append(',');
sb.append("maxLength");
sb.append('=');
sb.append(((this.maxLength == null)?"":this.maxLength));
sb.append(',');
sb.append("maxLengthBytes");
sb.append('=');
sb.append(((this.maxLengthBytes == null)?"":this.maxLengthBytes));
sb.append(',');
sb.append("messageTtl");
sb.append('=');
sb.append(((this.messageTtl == null)?"":this.messageTtl));
sb.append(',');
sb.append("queueMasterLocator");
sb.append('=');
sb.append(((this.queueMasterLocator == null)?"":this.queueMasterLocator));
sb.append(',');
sb.append("additionalProperties");
sb.append('=');
sb.append(((this.additionalProperties == null)?"":this.additionalProperties));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}
@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.queueMasterLocator == null)? 0 :this.queueMasterLocator.hashCode()));
result = ((result* 31)+((this.expires == null)? 0 :this.expires.hashCode()));
result = ((result* 31)+((this.haSyncBatchSize == null)? 0 :this.haSyncBatchSize.hashCode()));
result = ((result* 31)+((this.deadLetterExchange == null)? 0 :this.deadLetterExchange.hashCode()));
result = ((result* 31)+((this.haPromoteOnShutdown == null)? 0 :this.haPromoteOnShutdown.hashCode()));
result = ((result* 31)+((this.haMode == null)? 0 :this.haMode.hashCode()));
result = ((result* 31)+((this.haSyncMode == null)? 0 :this.haSyncMode.hashCode()));
result = ((result* 31)+((this.deadLetterRoutingKey == null)? 0 :this.deadLetterRoutingKey.hashCode()));
result = ((result* 31)+((this.alternateExchange == null)? 0 :this.alternateExchange.hashCode()));
result = ((result* 31)+((this.haParams == null)? 0 :this.haParams.hashCode()));
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
result = ((result* 31)+((this.messageTtl == null)? 0 :this.messageTtl.hashCode()));
result = ((result* 31)+((this.maxLength == null)? 0 :this.maxLength.hashCode()));
result = ((result* 31)+((this.maxLengthBytes == null)? 0 :this.maxLengthBytes.hashCode()));
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Definition) == false) {
return false;
}
Definition rhs = ((Definition) other);
return (((((((((((((((this.queueMasterLocator == rhs.queueMasterLocator)||((this.queueMasterLocator!= null)&&this.queueMasterLocator.equals(rhs.queueMasterLocator)))&&((this.expires == rhs.expires)||((this.expires!= null)&&this.expires.equals(rhs.expires))))&&((this.haSyncBatchSize == rhs.haSyncBatchSize)||((this.haSyncBatchSize!= null)&&this.haSyncBatchSize.equals(rhs.haSyncBatchSize))))&&((this.deadLetterExchange == rhs.deadLetterExchange)||((this.deadLetterExchange!= null)&&this.deadLetterExchange.equals(rhs.deadLetterExchange))))&&((this.haPromoteOnShutdown == rhs.haPromoteOnShutdown)||((this.haPromoteOnShutdown!= null)&&this.haPromoteOnShutdown.equals(rhs.haPromoteOnShutdown))))&&((this.haMode == rhs.haMode)||((this.haMode!= null)&&this.haMode.equals(rhs.haMode))))&&((this.haSyncMode == rhs.haSyncMode)||((this.haSyncMode!= null)&&this.haSyncMode.equals(rhs.haSyncMode))))&&((this.deadLetterRoutingKey == rhs.deadLetterRoutingKey)||((this.deadLetterRoutingKey!= null)&&this.deadLetterRoutingKey.equals(rhs.deadLetterRoutingKey))))&&((this.alternateExchange == rhs.alternateExchange)||((this.alternateExchange!= null)&&this.alternateExchange.equals(rhs.alternateExchange))))&&((this.haParams == rhs.haParams)||((this.haParams!= null)&&this.haParams.equals(rhs.haParams))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.messageTtl == rhs.messageTtl)||((this.messageTtl!= null)&&this.messageTtl.equals(rhs.messageTtl))))&&((this.maxLength == rhs.maxLength)||((this.maxLength!= null)&&this.maxLength.equals(rhs.maxLength))))&&((this.maxLengthBytes == rhs.maxLengthBytes)||((this.maxLengthBytes!= null)&&this.maxLengthBytes.equals(rhs.maxLengthBytes))));
}
public enum HaMode {
ALL("all"),
EXACTLY("exactly"),
NODES("nodes");
private final String value;
private final static Map CONSTANTS = new HashMap();
static {
for (Definition.HaMode c: values()) {
CONSTANTS.put(c.value, c);
}
}
private HaMode(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
@JsonValue
public String value() {
return this.value;
}
@JsonCreator
public static Definition.HaMode fromValue(String value) {
Definition.HaMode constant = CONSTANTS.get(value);
if (constant == null) {
throw new IllegalArgumentException(value);
} else {
return constant;
}
}
}
public enum HaPromoteOnShutdown {
WHEN_SYNCED("when-synced"),
ALWAYS("always");
private final String value;
private final static Map CONSTANTS = new HashMap();
static {
for (Definition.HaPromoteOnShutdown c: values()) {
CONSTANTS.put(c.value, c);
}
}
private HaPromoteOnShutdown(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
@JsonValue
public String value() {
return this.value;
}
@JsonCreator
public static Definition.HaPromoteOnShutdown fromValue(String value) {
Definition.HaPromoteOnShutdown constant = CONSTANTS.get(value);
if (constant == null) {
throw new IllegalArgumentException(value);
} else {
return constant;
}
}
}
public enum HaSyncMode {
AUTOMATIC("automatic"),
MANUAL("manual");
private final String value;
private final static Map CONSTANTS = new HashMap();
static {
for (Definition.HaSyncMode c: values()) {
CONSTANTS.put(c.value, c);
}
}
private HaSyncMode(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
@JsonValue
public String value() {
return this.value;
}
@JsonCreator
public static Definition.HaSyncMode fromValue(String value) {
Definition.HaSyncMode constant = CONSTANTS.get(value);
if (constant == null) {
throw new IllegalArgumentException(value);
} else {
return constant;
}
}
}
public enum QueueMasterLocator {
MIN_MASTERS("min-masters"),
CLIENT_LOCAL("client-local"),
RANDOM("random");
private final String value;
private final static Map CONSTANTS = new HashMap();
static {
for (Definition.QueueMasterLocator c: values()) {
CONSTANTS.put(c.value, c);
}
}
private QueueMasterLocator(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
@JsonValue
public String value() {
return this.value;
}
@JsonCreator
public static Definition.QueueMasterLocator fromValue(String value) {
Definition.QueueMasterLocator constant = CONSTANTS.get(value);
if (constant == null) {
throw new IllegalArgumentException(value);
} else {
return constant;
}
}
}
}