io.quarkiverse.reactive.messaging.nats.jetstream.JetStreamConnectorIncomingConfiguration Maven / Gradle / Ivy
package io.quarkiverse.reactive.messaging.nats.jetstream;
import java.util.Optional;
import org.eclipse.microprofile.config.Config;
/**
* Extract the incoming configuration for the {@code quarkus-jetstream} connector.
*/
public class JetStreamConnectorIncomingConfiguration extends JetStreamConnectorCommonConfiguration {
/**
* Creates a new JetStreamConnectorIncomingConfiguration.
*/
public JetStreamConnectorIncomingConfiguration(Config config) {
super(config);
validate();
}
/**
* Gets the name value from the configuration.
* Attribute Name: name
* Description: The name of the NATS consumer
* @return the name
*/
public Optional getName() {
return config.getOptionalValue("name", String.class);
}
/**
* Gets the publisher-type value from the configuration.
* Attribute Name: publisher-type
* Description: The publisher type (Pull, Push)
* Default Value: Pull
* @return the publisher-type
*/
public String getPublisherType() {
return config.getOptionalValue("publisher-type", String.class)
.orElse("Pull");
}
/**
* Gets the payload-type value from the configuration.
* Attribute Name: payload-type
* Description: The payload type
* @return the payload-type
*/
public Optional getPayloadType() {
return config.getOptionalValue("payload-type", String.class);
}
/**
* Gets the durable value from the configuration.
* Attribute Name: durable
* Description: Sets the durable name for the consumer
* @return the durable
*/
public Optional getDurable() {
return config.getOptionalValue("durable", String.class);
}
/**
* Gets the filter-subjects value from the configuration.
* Attribute Name: filter-subjects
* Description: A comma separated list of subjects that overlap with the subjects bound to the stream to filter delivery to subscribers
* @return the filter-subjects
*/
public Optional getFilterSubjects() {
return config.getOptionalValue("filter-subjects", String.class);
}
/**
* Gets the ack-wait value from the configuration.
* Attribute Name: ack-wait
* Description: The duration that the server will wait for an ack for any individual message once it has been delivered to a consumer. If an ack is not received in time, the message will be redelivered.
* @return the ack-wait
*/
public Optional getAckWait() {
return config.getOptionalValue("ack-wait", String.class);
}
/**
* Gets the deliver-policy value from the configuration.
* Attribute Name: deliver-policy
* Description: The point in the stream to receive messages from, either DeliverAll, DeliverLast, DeliverNew, DeliverByStartSequence, DeliverByStartTime, or DeliverLastPerSubject.
* @return the deliver-policy
*/
public Optional getDeliverPolicy() {
return config.getOptionalValue("deliver-policy", String.class);
}
/**
* Gets the description value from the configuration.
* Attribute Name: description
* Description: A description of the consumer.
* @return the description
*/
public Optional getDescription() {
return config.getOptionalValue("description", String.class);
}
/**
* Gets the inactive-threshold value from the configuration.
* Attribute Name: inactive-threshold
* Description: Duration that instructs the server to cleanup consumers that are inactive for that long.
* @return the inactive-threshold
*/
public Optional getInactiveThreshold() {
return config.getOptionalValue("inactive-threshold", String.class);
}
/**
* Gets the max-ack-pending value from the configuration.
* Attribute Name: max-ack-pending
* Description: Defines the maximum number of messages, without an acknowledgement, that can be outstanding.
* @return the max-ack-pending
*/
public Optional getMaxAckPending() {
return config.getOptionalValue("max-ack-pending", Long.class);
}
/**
* Gets the max-deliver value from the configuration.
* Attribute Name: max-deliver
* Description: The maximum number of times a specific message delivery will be attempted
* @return the max-deliver
*/
public Optional getMaxDeliver() {
return config.getOptionalValue("max-deliver", Long.class);
}
/**
* Gets the replay-policy value from the configuration.
* Attribute Name: replay-policy
* Description: If the policy is ReplayOriginal, the messages in the stream will be pushed to the client at the same rate that they were originally received, simulating the original timing of messages. If the policy is ReplayInstant (the default), the messages will be pushed to the client as fast as possible while adhering to the Ack Policy, Max Ack Pending and the client's ability to consume those messages.
* @return the replay-policy
*/
public Optional getReplayPolicy() {
return config.getOptionalValue("replay-policy", String.class);
}
/**
* Gets the replicas value from the configuration.
* Attribute Name: replicas
* Description: Sets the number of replicas for the consumer's state. By default, when the value is set to zero, consumers inherit the number of replicas from the stream.
* @return the replicas
*/
public Optional getReplicas() {
return config.getOptionalValue("replicas", Integer.class);
}
/**
* Gets the memory-storage value from the configuration.
* Attribute Name: memory-storage
* Description: If set, forces the consumer state to be kept in memory rather than inherit the storage type of the stream (file in this case).
* @return the memory-storage
*/
public Optional getMemoryStorage() {
return config.getOptionalValue("memory-storage", Boolean.class);
}
/**
* Gets the back-off value from the configuration.
* Attribute Name: back-off
* Description: The timing of re-deliveries as a comma-separated list of durations
* @return the back-off
*/
public Optional getBackOff() {
return config.getOptionalValue("back-off", String.class);
}
/**
* Gets the retry-backoff value from the configuration.
* Attribute Name: retry-backoff
* Description: The retry backoff in milliseconds for retry publishing messages
* Default Value: 10000
* @return the retry-backoff
*/
public Long getRetryBackoff() {
return config.getOptionalValue("retry-backoff", Long.class)
.orElse(Long.valueOf("10000"));
}
/**
* Gets the exponential-backoff value from the configuration.
* Attribute Name: exponential-backoff
* Description: Calculation a exponential backoff using deliveredCount metadata (NB back-off must undefined to work properly)
* Default Value: false
* @return the exponential-backoff
*/
public Boolean getExponentialBackoff() {
return config.getOptionalValue("exponential-backoff", Boolean.class)
.orElse(Boolean.valueOf("false"));
}
/**
* Gets the exponential-backoff-max-duration value from the configuration.
* Attribute Name: exponential-backoff-max-duration
* Description: The maximum duration of exponential backoff
* Default Value: PT2M
* @return the exponential-backoff-max-duration
*/
public String getExponentialBackoffMaxDuration() {
return config.getOptionalValue("exponential-backoff-max-duration", String.class)
.orElse("PT2M");
}
/**
* Gets the ack-timeout value from the configuration.
* Attribute Name: ack-timeout
* Description: The duration to wait for an ack confirmation
* Default Value: PT2S
* @return the ack-timeout
*/
public String getAckTimeout() {
return config.getOptionalValue("ack-timeout", String.class)
.orElse("PT2S");
}
/**
* Gets the pull.batch-size value from the configuration.
* Attribute Name: pull.batch-size
* Description: The size of batch of messages to be pulled in pull mode
* Default Value: 100
* @return the pull.batch-size
*/
public Integer getPullBatchSize() {
return config.getOptionalValue("pull.batch-size", Integer.class)
.orElse(Integer.valueOf("100"));
}
/**
* Gets the pull.repull-at value from the configuration.
* Attribute Name: pull.repull-at
* Description: The point in the current batch to tell the server to start the next batch
* Default Value: 50
* @return the pull.repull-at
*/
public Integer getPullRepullAt() {
return config.getOptionalValue("pull.repull-at", Integer.class)
.orElse(Integer.valueOf("50"));
}
/**
* Gets the pull.max-waiting value from the configuration.
* Attribute Name: pull.max-waiting
* Description: The maximum number of waiting pull requests.
* @return the pull.max-waiting
*/
public Optional getPullMaxWaiting() {
return config.getOptionalValue("pull.max-waiting", Integer.class);
}
/**
* Gets the pull.max-expires value from the configuration.
* Attribute Name: pull.max-expires
* Description: The maximum duration a single pull request will wait for messages to be available to pull.
* @return the pull.max-expires
*/
public Optional getPullMaxExpires() {
return config.getOptionalValue("pull.max-expires", String.class);
}
/**
* Gets the push.ordered value from the configuration.
* Attribute Name: push.ordered
* Description: Flag indicating whether this subscription should be ordered
* @return the push.ordered
*/
public Optional getPushOrdered() {
return config.getOptionalValue("push.ordered", Boolean.class);
}
/**
* Gets the push.deliver-group value from the configuration.
* Attribute Name: push.deliver-group
* Description: The optional deliver group to join
* @return the push.deliver-group
*/
public Optional getPushDeliverGroup() {
return config.getOptionalValue("push.deliver-group", String.class);
}
/**
* Gets the push.flow-control value from the configuration.
* Attribute Name: push.flow-control
* Description: Enables per-subscription flow control using a sliding-window protocol. This protocol relies on the server and client exchanging messages to regulate when and how many messages are pushed to the client. This one-to-one flow control mechanism works in tandem with the one-to-many flow control imposed by MaxAckPending across all subscriptions bound to a consumer.
* @return the push.flow-control
*/
public Optional getPushFlowControl() {
return config.getOptionalValue("push.flow-control", String.class);
}
/**
* Gets the push.idle-heart-beat value from the configuration.
* Attribute Name: push.idle-heart-beat
* Description: If the idle heartbeat period is set, the server will regularly send a status message to the client (i.e. when the period has elapsed) while there are no new messages to send. This lets the client know that the JetStream service is still up and running, even when there is no activity on the stream. The message status header will have a code of 100. Unlike FlowControl, it will have no reply to address. It may have a description such "Idle Heartbeat". Note that this heartbeat mechanism is all handled transparently by supported clients and does not need to be handled by the application.
* @return the push.idle-heart-beat
*/
public Optional getPushIdleHeartBeat() {
return config.getOptionalValue("push.idle-heart-beat", String.class);
}
/**
* Gets the push.rate-limit value from the configuration.
* Attribute Name: push.rate-limit
* Description: Used to throttle the delivery of messages to the consumer, in bits per second.
* @return the push.rate-limit
*/
public Optional getPushRateLimit() {
return config.getOptionalValue("push.rate-limit", Long.class);
}
/**
* Gets the push.headers-only value from the configuration.
* Attribute Name: push.headers-only
* Description: Delivers only the headers of messages in the stream and not the bodies. Additionally adds Nats-Msg-Size header to indicate the size of the removed payload.
* @return the push.headers-only
*/
public Optional getPushHeadersOnly() {
return config.getOptionalValue("push.headers-only", Boolean.class);
}
public void validate() {
super.validate();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy