Interface NatsComponentBuilderFactory.NatsComponentBuilder
- All Superinterfaces:
ComponentBuilder<org.apache.camel.component.nats.NatsComponent>
- All Known Implementing Classes:
NatsComponentBuilderFactory.NatsComponentBuilderImpl
- Enclosing interface:
NatsComponentBuilderFactory
public static interface NatsComponentBuilderFactory.NatsComponentBuilder
extends ComponentBuilder<org.apache.camel.component.nats.NatsComponent>
Builder for the Nats component.
-
Method Summary
Modifier and TypeMethodDescriptionackPolicy(io.nats.client.api.AckPolicy ackPolicy) Acknowledgement mode. none = Messages are acknowledged as soon as the server sends them (danger: messages that Camel failed to process is also ack).ackWait(long ackWait) After a message is delivered to a consumer, the server waits 30 seconds (default) for an acknowledgement.autowiredEnabled(boolean autowiredEnabled) Whether autowiring is enabled.bridgeErrorHandler(boolean bridgeErrorHandler) Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler.configuration(org.apache.camel.component.nats.NatsConfiguration configuration) To use a shared configuration.connection(io.nats.client.Connection connection) Reference an already instantiated connection to Nats server.connectionTimeout(int connectionTimeout) Timeout for connection attempts.consumerConfiguration(io.nats.client.api.ConsumerConfiguration consumerConfiguration) Sets a custom ConsumerConfiguration object for the JetStream consumer.credentialsFilePath(String credentialsFilePath) If we use useCredentialsFile to true we'll need to set the credentialsFilePath option.durableName(String durableName) Sets the name to assign to the JetStream durable consumer.flushConnection(boolean flushConnection) Define if we want to flush connection when stopping or not.flushTimeout(int flushTimeout) Set the flush timeout (in milliseconds).headerFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom header filter strategy.jetstreamAsync(boolean jetstreamAsync) Sets whether to operate JetStream requests asynchronously.jetstreamEnabled(boolean jetstreamEnabled) Sets whether to enable JetStream support for this endpoint.jetstreamName(String jetstreamName) Sets the name of the JetStream stream to use.lazyStartProducer(boolean lazyStartProducer) Whether the producer should be started lazy (on the first message).manualAck(boolean manualAck) Whether to allow doing manual acknowledgment via NatsManualAck.maxDeliver(long maxDeliver) Maximum number of attempts to deliver a message from Nats to a consumer.maxMessages(String maxMessages) Stop receiving messages from a topic we are subscribing to after maxMessages.maxPingsOut(int maxPingsOut) maximum number of pings have not received a response allowed by the client.maxReconnectAttempts(int maxReconnectAttempts) Max reconnection attempts.nackWait(long nackWait) For negative acknowledgements (NAK), redelivery is delayed by 5 seconds (default).noEcho(boolean noEcho) Turn off echo.noRandomizeServers(boolean noRandomizeServers) Whether or not randomizing the order of servers for the connection attempts.pedantic(boolean pedantic) Whether or not running in pedantic mode (this affects performance).pingInterval(int pingInterval) Ping interval to be aware if connection is still alive (in milliseconds).poolSize(int poolSize) Consumer thread pool size (default is 10).pullBatchSize(int pullBatchSize) Maximum number of messages to fetch per pull request when using a JetStream Pull Subscription.pullFetchTimeout(long pullFetchTimeout) Maximum time (in milliseconds) to wait for a batch of messages to be available on the server during a single fetch when using a JetStream Pull Subscription.pullSubscription(boolean pullSubscription) Sets the consumer subscription type for JetStream.The Queue name if we are using nats for a queue configuration.reconnect(boolean reconnect) Whether or not using reconnection feature.reconnectTimeWait(int reconnectTimeWait) Waiting time before attempts reconnection (in milliseconds).replySubject(String replySubject) the subject to which subscribers should send response.replyToDisabled(boolean replyToDisabled) Can be used to turn off sending back reply message in the consumer.requestCleanupInterval(int requestCleanupInterval) Interval to clean up cancelled/timed out requests.requestTimeout(long requestTimeout) Request timeout in milliseconds.secure(boolean secure) Set secure option indicating TLS is required.URLs to one or more NAT servers.sslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters) To configure security using SSLContextParameters.traceConnection(boolean traceConnection) Whether or not connection trace messages should be printed to standard out for fine grained debugging of connection issues.useGlobalSslContextParameters(boolean useGlobalSslContextParameters) Enable usage of global SSL context parameters.verbose(boolean verbose) Whether or not running in verbose mode.Methods inherited from interface ComponentBuilder
build, build, doSetProperty, register
-
Method Details
-
configuration
default NatsComponentBuilderFactory.NatsComponentBuilder configuration(org.apache.camel.component.nats.NatsConfiguration configuration) To use a shared configuration. The option is a: <code>org.apache.camel.component.nats.NatsConfiguration</code> type. Group: common- Parameters:
configuration- the value to set- Returns:
- the dsl builder
-
connectionTimeout
Timeout for connection attempts. (in milliseconds). The option is a: <code>int</code> type. Default: 2000 Group: common- Parameters:
connectionTimeout- the value to set- Returns:
- the dsl builder
-
flushConnection
Define if we want to flush connection when stopping or not. The option is a: <code>boolean</code> type. Default: true Group: common- Parameters:
flushConnection- the value to set- Returns:
- the dsl builder
-
flushTimeout
Set the flush timeout (in milliseconds). The option is a: <code>int</code> type. Default: 1000 Group: common- Parameters:
flushTimeout- the value to set- Returns:
- the dsl builder
-
jetstreamEnabled
Sets whether to enable JetStream support for this endpoint. The option is a: <code>boolean</code> type. Default: false Group: common- Parameters:
jetstreamEnabled- the value to set- Returns:
- the dsl builder
-
jetstreamName
Sets the name of the JetStream stream to use. The option is a: <code>java.lang.String</code> type. Group: common- Parameters:
jetstreamName- the value to set- Returns:
- the dsl builder
-
maxPingsOut
maximum number of pings have not received a response allowed by the client. The option is a: <code>int</code> type. Default: 2 Group: common- Parameters:
maxPingsOut- the value to set- Returns:
- the dsl builder
-
maxReconnectAttempts
default NatsComponentBuilderFactory.NatsComponentBuilder maxReconnectAttempts(int maxReconnectAttempts) Max reconnection attempts. The option is a: <code>int</code> type. Default: 60 Group: common- Parameters:
maxReconnectAttempts- the value to set- Returns:
- the dsl builder
-
noEcho
Turn off echo. If supported by the gnatsd version you are connecting to this flag will prevent the server from echoing messages back to the connection if it has subscriptions on the subject being published to. The option is a: <code>boolean</code> type. Default: false Group: common- Parameters:
noEcho- the value to set- Returns:
- the dsl builder
-
noRandomizeServers
default NatsComponentBuilderFactory.NatsComponentBuilder noRandomizeServers(boolean noRandomizeServers) Whether or not randomizing the order of servers for the connection attempts. The option is a: <code>boolean</code> type. Default: false Group: common- Parameters:
noRandomizeServers- the value to set- Returns:
- the dsl builder
-
pedantic
Whether or not running in pedantic mode (this affects performance). The option is a: <code>boolean</code> type. Default: false Group: common- Parameters:
pedantic- the value to set- Returns:
- the dsl builder
-
pingInterval
Ping interval to be aware if connection is still alive (in milliseconds). The option is a: <code>int</code> type. Default: 120000 Group: common- Parameters:
pingInterval- the value to set- Returns:
- the dsl builder
-
reconnect
Whether or not using reconnection feature. The option is a: <code>boolean</code> type. Default: true Group: common- Parameters:
reconnect- the value to set- Returns:
- the dsl builder
-
reconnectTimeWait
Waiting time before attempts reconnection (in milliseconds). The option is a: <code>int</code> type. Default: 2000 Group: common- Parameters:
reconnectTimeWait- the value to set- Returns:
- the dsl builder
-
requestCleanupInterval
default NatsComponentBuilderFactory.NatsComponentBuilder requestCleanupInterval(int requestCleanupInterval) Interval to clean up cancelled/timed out requests. The option is a: <code>int</code> type. Default: 5000 Group: common- Parameters:
requestCleanupInterval- the value to set- Returns:
- the dsl builder
-
servers
URLs to one or more NAT servers. Use comma to separate URLs when specifying multiple servers. The option is a: <code>java.lang.String</code> type. Group: common- Parameters:
servers- the value to set- Returns:
- the dsl builder
-
verbose
Whether or not running in verbose mode. The option is a: <code>boolean</code> type. Default: false Group: common- Parameters:
verbose- the value to set- Returns:
- the dsl builder
-
ackPolicy
default NatsComponentBuilderFactory.NatsComponentBuilder ackPolicy(io.nats.client.api.AckPolicy ackPolicy) Acknowledgement mode. none = Messages are acknowledged as soon as the server sends them (danger: messages that Camel failed to process is also ack). Clients do not need to ack. all = All messages with a sequence number less than the message acked are also acknowledged. E.g. reading a batch of messages 1..100. Ack on message 100 will acknowledge 1..99 as well. explicit (default) = Each message is acknowledged individually by Camel after the message has been processed, this ensures the message is only ack if success and nack if processing failed due to an exception during routing. Message can be acked out of sequence and create gaps of unacknowledged messages in the consumer. The option is a: <code>io.nats.client.api.AckPolicy</code> type. Default: Explicit Group: consumer- Parameters:
ackPolicy- the value to set- Returns:
- the dsl builder
-
ackWait
After a message is delivered to a consumer, the server waits 30 seconds (default) for an acknowledgement. If none arrives (timeout), the message becomes eligible for redelivery. The option is a: <code>long</code> type. Default: 30000 Group: consumer- Parameters:
ackWait- the value to set- Returns:
- the dsl builder
-
bridgeErrorHandler
default NatsComponentBuilderFactory.NatsComponentBuilder bridgeErrorHandler(boolean bridgeErrorHandler) Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. The option is a: <code>boolean</code> type. Default: false Group: consumer- Parameters:
bridgeErrorHandler- the value to set- Returns:
- the dsl builder
-
durableName
Sets the name to assign to the JetStream durable consumer. Setting this value makes the consumer durable. The value is used to set the durable() field in the underlying NATS ConsumerConfiguration.Builder. The option is a: <code>java.lang.String</code> type. Group: consumer- Parameters:
durableName- the value to set- Returns:
- the dsl builder
-
manualAck
Whether to allow doing manual acknowledgment via NatsManualAck. If this option is enabled then an instance of NatsManualAck is stored on the org.apache.camel.Exchange message header, which allows end users to access this API and perform manual ack/nak/term operations via the JetStream consumer. When enabled, the automatic acknowledgment on exchange completion is disabled. If the user does not call any ack method, the message remains unacknowledged and NATS will redeliver it after the ackWait timeout expires. This option is only applicable when JetStream is enabled (jetstreamEnabled=true). It has no effect when ackPolicy=None since the server acknowledges messages automatically on delivery. The option is a: <code>boolean</code> type. Default: false Group: consumer- Parameters:
manualAck- the value to set- Returns:
- the dsl builder
-
maxDeliver
Maximum number of attempts to deliver a message from Nats to a consumer. Once MaxDeliver is reached, the NATS server stops attempting to deliver that specific message. The message is not deleted, it remains in the stream but is simply skipped. It is recommended to set this option to a sensible value in case a message is poison and can not successfully be processed and would always keep failing. The option is a: <code>long</code> type. Group: consumer- Parameters:
maxDeliver- the value to set- Returns:
- the dsl builder
-
maxMessages
Stop receiving messages from a topic we are subscribing to after maxMessages. The option is a: <code>java.lang.String</code> type. Group: consumer- Parameters:
maxMessages- the value to set- Returns:
- the dsl builder
-
nackWait
For negative acknowledgements (NAK), redelivery is delayed by 5 seconds (default). Setting this to 0 or negative makes the redelivery immediately. Be careful as this can cause the consumer to keep re-processing the same message over and over again due to intermediate error that last a while. The option is a: <code>long</code> type. Default: 5000 Group: consumer- Parameters:
nackWait- the value to set- Returns:
- the dsl builder
-
poolSize
Consumer thread pool size (default is 10). The option is a: <code>int</code> type. Default: 10 Group: consumer- Parameters:
poolSize- the value to set- Returns:
- the dsl builder
-
pullBatchSize
Maximum number of messages to fetch per pull request when using a JetStream Pull Subscription. Only used when {code pullSubscription=true}. The option is a: <code>int</code> type. Default: 10 Group: consumer- Parameters:
pullBatchSize- the value to set- Returns:
- the dsl builder
-
pullFetchTimeout
Maximum time (in milliseconds) to wait for a batch of messages to be available on the server during a single fetch when using a JetStream Pull Subscription. Only used when {code pullSubscription=true}. The option is a: <code>long</code> type. Default: 1000 Group: consumer- Parameters:
pullFetchTimeout- the value to set- Returns:
- the dsl builder
-
pullSubscription
Sets the consumer subscription type for JetStream. Set to true to use a Pull Subscription (consumer explicitly requests messages). Set to false to use a Push Subscription (messages are automatically delivered). The option is a: <code>boolean</code> type. Default: true Group: consumer- Parameters:
pullSubscription- the value to set- Returns:
- the dsl builder
-
queueName
The Queue name if we are using nats for a queue configuration. The option is a: <code>java.lang.String</code> type. Group: consumer- Parameters:
queueName- the value to set- Returns:
- the dsl builder
-
replyToDisabled
Can be used to turn off sending back reply message in the consumer. The option is a: <code>boolean</code> type. Default: false Group: consumer- Parameters:
replyToDisabled- the value to set- Returns:
- the dsl builder
-
consumerConfiguration
default NatsComponentBuilderFactory.NatsComponentBuilder consumerConfiguration(io.nats.client.api.ConsumerConfiguration consumerConfiguration) Sets a custom ConsumerConfiguration object for the JetStream consumer. This is an advanced option typically used when you need to configure properties not exposed as simple Camel URI parameters. When set, this object will be used to build the final consumer subscription options. The option is a: <code>io.nats.client.api.ConsumerConfiguration</code> type. Group: consumer (advanced)- Parameters:
consumerConfiguration- the value to set- Returns:
- the dsl builder
-
lazyStartProducer
default NatsComponentBuilderFactory.NatsComponentBuilder lazyStartProducer(boolean lazyStartProducer) Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. The option is a: <code>boolean</code> type. Default: false Group: producer- Parameters:
lazyStartProducer- the value to set- Returns:
- the dsl builder
-
replySubject
the subject to which subscribers should send response. The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
replySubject- the value to set- Returns:
- the dsl builder
-
requestTimeout
Request timeout in milliseconds. The option is a: <code>long</code> type. Default: 20000 Group: producer- Parameters:
requestTimeout- the value to set- Returns:
- the dsl builder
-
autowiredEnabled
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. The option is a: <code>boolean</code> type. Default: true Group: advanced- Parameters:
autowiredEnabled- the value to set- Returns:
- the dsl builder
-
connection
default NatsComponentBuilderFactory.NatsComponentBuilder connection(io.nats.client.Connection connection) Reference an already instantiated connection to Nats server. The option is a: <code>io.nats.client.Connection</code> type. Group: advanced- Parameters:
connection- the value to set- Returns:
- the dsl builder
-
headerFilterStrategy
default NatsComponentBuilderFactory.NatsComponentBuilder headerFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy headerFilterStrategy) To use a custom header filter strategy. The option is a: <code>org.apache.camel.spi.HeaderFilterStrategy</code> type. Group: advanced- Parameters:
headerFilterStrategy- the value to set- Returns:
- the dsl builder
-
jetstreamAsync
Sets whether to operate JetStream requests asynchronously. The option is a: <code>boolean</code> type. Default: true Group: advanced- Parameters:
jetstreamAsync- the value to set- Returns:
- the dsl builder
-
traceConnection
Whether or not connection trace messages should be printed to standard out for fine grained debugging of connection issues. The option is a: <code>boolean</code> type. Default: false Group: advanced- Parameters:
traceConnection- the value to set- Returns:
- the dsl builder
-
credentialsFilePath
default NatsComponentBuilderFactory.NatsComponentBuilder credentialsFilePath(String credentialsFilePath) If we use useCredentialsFile to true we'll need to set the credentialsFilePath option. It can be loaded by default from classpath, but you can prefix with classpath:, file:, or http: to load the resource from different systems. The option is a: <code>java.lang.String</code> type. Group: security- Parameters:
credentialsFilePath- the value to set- Returns:
- the dsl builder
-
secure
Set secure option indicating TLS is required. The option is a: <code>boolean</code> type. Default: false Group: security- Parameters:
secure- the value to set- Returns:
- the dsl builder
-
sslContextParameters
default NatsComponentBuilderFactory.NatsComponentBuilder sslContextParameters(org.apache.camel.support.jsse.SSLContextParameters sslContextParameters) To configure security using SSLContextParameters. The option is a: <code>org.apache.camel.support.jsse.SSLContextParameters</code> type. Group: security- Parameters:
sslContextParameters- the value to set- Returns:
- the dsl builder
-
useGlobalSslContextParameters
default NatsComponentBuilderFactory.NatsComponentBuilder useGlobalSslContextParameters(boolean useGlobalSslContextParameters) Enable usage of global SSL context parameters. The option is a: <code>boolean</code> type. Default: false Group: security- Parameters:
useGlobalSslContextParameters- the value to set- Returns:
- the dsl builder
-