Class NatsConnectionFromProperties
- All Implemented Interfaces:
AdaptrisComponent,AdaptrisConnection,ComponentLifecycle,ComponentLifecycleExtension,StateManagedComponent
Uses io.nats.client#Options#Builder() to build the connection via the properties; no validation of properties is done, we just
convert the configuration into properties and pass it into the Builder object.
Configuring any kind of ConnectionErrorHandler has no effect on this type of connection, as we will be relying on the automatic
reconnection that happens behind the seens from the NATS core java client.
In the adapter configuration file this class is aliased as nats-server-properties-connection which is the preferred alternative to the fully qualified classname when building your configuration.
-
Field Summary
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected io.nats.client.Connectionconnect()protected Stringprotected static StringThe connection properties.protected voidvoidsetConnectionProperties(KeyValuePairSet connectionProperties) The connection properties.<T extends NatsConnectionFromProperties>
TMethods inherited from class com.adaptris.interlok.nats.NatsConnection
clientConnection, close, closeConnection, createDispatcher, exceedsMaxAttempts, initConnection, startConnection, stopConnection, withConnectionRetriesMethods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryIntervalMethods inherited from class com.adaptris.core.AdaptrisConnectionImp
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
-
Constructor Details
-
NatsConnectionFromProperties
public NatsConnectionFromProperties()
-
-
Method Details
-
prepareConnection
- Overrides:
prepareConnectionin classNatsConnection- Throws:
CoreException
-
connect
- Specified by:
connectin classNatsConnection- Throws:
Exception
-
withConnectionProperties
-
connectionName
- Specified by:
connectionNamein classNatsConnection
-
findConnectionName
-
getConnectionProperties
The connection properties.You will probably need to refer to the NATS.io documentation to figure out the available properties; they will be passed in as-is to
new Options.Builder(Properties)with no verification. Generally the configuration properties will start withio.nats.client.but may change between releases.For instance if you wanted to control the URL / Username + Password then you might have
io.nats.client.url=nats://localhost:1234 io.nats.client.username=MyUsername io.nats.client.password=MyPassword io.nats.client.verbose=true -
setConnectionProperties
The connection properties.You will probably need to refer to the NATS.io documentation to figure out the available properties; they will be passed in as-is to
new Options.Builder(Properties)with no verification. Generally the configuration properties will start withio.nats.client.but may change between releases.For instance if you wanted to control the URL / Username + Password then you might have
io.nats.client.url=nats://localhost:1234 io.nats.client.username=MyUsername io.nats.client.password=MyPassword io.nats.client.verbose=true
-