Package io.hekate.messaging
Class MessagingConfigBase<T extends MessagingConfigBase<T>>
- java.lang.Object
-
- io.hekate.messaging.MessagingConfigBase<T>
-
- Type Parameters:
T
- Syb-class type.
- Direct Known Subclasses:
MessagingChannelConfig
,RpcServiceFactory
public abstract class MessagingConfigBase<T extends MessagingConfigBase<T>> extends Object
Common configuration options for components that provide messaging support.
-
-
Constructor Summary
Constructors Constructor Description MessagingConfigBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessagingBackPressureConfig
getBackPressure()
Returns the back pressure configuration (seesetBackPressure(MessagingBackPressureConfig)
).long
getIdleSocketTimeout()
Returns the idle socket timeout in milliseconds (seesetIdleSocketTimeout(long)
).int
getNioThreads()
Returns the size of a thread pool for handling NIO-based socket connections (seesetNioThreads(int)
).void
setBackPressure(MessagingBackPressureConfig backPressure)
Sets the back pressure configuration.void
setIdleSocketTimeout(long idleSocketTimeout)
Sets idle socket timeout in milliseconds.void
setNioThreads(int nioThreads)
Sets the size of a thread pool for handling NIO-based socket connections.T
withBackPressure(MessagingBackPressureConfig backPressure)
Fluent-style version ofsetBackPressure(MessagingBackPressureConfig)
.T
withBackPressure(Consumer<MessagingBackPressureConfig> configurer)
Applies the specified consumer to the currentgetBackPressure()
configuration.T
withIdleSocketTimeout(long idleTimeout)
Fluent-style version ofsetIdleSocketTimeout(long)
.T
withNioThreads(int nioThreads)
Fluent-style version ofsetNioThreads(int)
.
-
-
-
Method Detail
-
getIdleSocketTimeout
public long getIdleSocketTimeout()
Returns the idle socket timeout in milliseconds (seesetIdleSocketTimeout(long)
).- Returns:
- Idle socket timeout in milliseconds.
-
setIdleSocketTimeout
public void setIdleSocketTimeout(long idleSocketTimeout)
Sets idle socket timeout in milliseconds.If there were no communication with some remote node for the duration of this time interval then all sockets connections with such node will be closed in order to save system resource. Connections will be automatically reestablish on the next attempt to send a message to that node.
If value of this parameter is less than or equals to zero (default value) then connections will not be closed while remote node stays alive.
- Parameters:
idleSocketTimeout
- Timeout in milliseconds.
-
withIdleSocketTimeout
public T withIdleSocketTimeout(long idleTimeout)
Fluent-style version ofsetIdleSocketTimeout(long)
.- Parameters:
idleTimeout
- Timeout in milliseconds.- Returns:
- This instance.
-
getNioThreads
public int getNioThreads()
Returns the size of a thread pool for handling NIO-based socket connections (seesetNioThreads(int)
).- Returns:
- Size of a thread pool for handling NIO-based socket connections.
-
setNioThreads
public void setNioThreads(int nioThreads)
Sets the size of a thread pool for handling NIO-based socket connections.If this parameter is less than or equals to zero (default value) then this channel will use the core thread pool of
NetworkService
(seeNetworkServiceFactory.setNioThreads(int)
).- Parameters:
nioThreads
- Size of a thread pool for handling NIO-based socket connections.
-
withNioThreads
public T withNioThreads(int nioThreads)
Fluent-style version ofsetNioThreads(int)
.- Parameters:
nioThreads
- Size of a thread pool for handling NIO-based socket connections.- Returns:
- This instance.
-
getBackPressure
public MessagingBackPressureConfig getBackPressure()
Returns the back pressure configuration (seesetBackPressure(MessagingBackPressureConfig)
).- Returns:
- Back pressure configuration.
-
setBackPressure
public void setBackPressure(MessagingBackPressureConfig backPressure)
Sets the back pressure configuration.If not specified then
MessagingBackPressureConfig
's defaults will be used.- Parameters:
backPressure
- Back pressure configuration.
-
withBackPressure
public T withBackPressure(MessagingBackPressureConfig backPressure)
Fluent-style version ofsetBackPressure(MessagingBackPressureConfig)
.- Parameters:
backPressure
- Back pressure configuration.- Returns:
- This instance.
-
withBackPressure
public T withBackPressure(Consumer<MessagingBackPressureConfig> configurer)
Applies the specified consumer to the currentgetBackPressure()
configuration.- Parameters:
configurer
- Configuration Consumer.- Returns:
- This instance.
-
-