Package com.adaptris.interlok.nats
Class NatsConnection
- java.lang.Object
-
- com.adaptris.core.AdaptrisConnectionImp
-
- com.adaptris.core.AllowsRetriesConnection
-
- com.adaptris.interlok.nats.NatsConnection
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisConnection
,ComponentLifecycle
,ComponentLifecycleExtension
,StateManagedComponent
- Direct Known Subclasses:
BasicNatsConnection
,NatsConnectionFromProperties
public abstract class NatsConnection extends AllowsRetriesConnection
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisConnectionImp
log
-
-
Constructor Summary
Constructors Constructor Description NatsConnection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description io.nats.client.Connection
clientConnection()
void
close(io.nats.client.Dispatcher dispatcher)
protected void
closeConnection()
protected abstract io.nats.client.Connection
connect()
protected abstract java.lang.String
connectionName()
io.nats.client.Dispatcher
createDispatcher(io.nats.client.MessageHandler handler)
protected <T extends java.lang.Exception>
voidexceedsMaxAttempts(int attemptCount, T e)
protected void
initConnection()
protected void
prepareConnection()
protected void
startConnection()
protected void
stopConnection()
<T extends NatsConnection>
TwithConnectionRetries(int i, TimeInterval t)
-
Methods inherited from class com.adaptris.core.AllowsRetriesConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
-
Methods 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
-
-
-
-
Method Detail
-
prepareConnection
protected void prepareConnection() throws CoreException
- Specified by:
prepareConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
-
initConnection
protected void initConnection() throws CoreException
- Specified by:
initConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
-
startConnection
protected void startConnection() throws CoreException
- Specified by:
startConnection
in classAdaptrisConnectionImp
- Throws:
CoreException
-
stopConnection
protected void stopConnection()
- Specified by:
stopConnection
in classAdaptrisConnectionImp
-
closeConnection
protected void closeConnection()
- Specified by:
closeConnection
in classAdaptrisConnectionImp
-
clientConnection
public io.nats.client.Connection clientConnection() throws java.lang.Exception
- Throws:
java.lang.Exception
-
createDispatcher
public io.nats.client.Dispatcher createDispatcher(io.nats.client.MessageHandler handler) throws java.lang.Exception
- Throws:
java.lang.Exception
-
close
public void close(io.nats.client.Dispatcher dispatcher)
-
connect
protected abstract io.nats.client.Connection connect() throws java.lang.Exception
- Throws:
java.lang.Exception
-
connectionName
protected abstract java.lang.String connectionName()
-
exceedsMaxAttempts
protected <T extends java.lang.Exception> void exceedsMaxAttempts(int attemptCount, T e) throws T extends java.lang.Exception
- Throws:
T extends java.lang.Exception
-
withConnectionRetries
public <T extends NatsConnection> T withConnectionRetries(int i, TimeInterval t)
-
-