All Downloads are FREE. Search and download functionalities are using the official Maven repository.

blended.jms.utils.BlendedJMSConnectionConfig.scala Maven / Gradle / Ivy

Go to download

A bundle to provide a ConnectionFactory wrapper that monitors a single connection and is able to monitor the connection via an active ping.

There is a newer version: 2.5.0-M10
Show newest version
package blended.jms.utils

import com.typesafe.config.Config

object BlendedJMSConnectionConfig {

  val defaultConfig = BlendedJMSConnectionConfig(5, 30, 3, 5, 300)

  def apply(cfg: Config) : BlendedJMSConnectionConfig = {
    val pingTolerance = if (cfg.hasPath("pingTolerance")) cfg.getInt("pingTolerance") else defaultConfig.pingTolerance
    val pingInterval  = if (cfg.hasPath("pingInterval")) cfg.getInt("pingInterval") else defaultConfig.pingInterval
    val pingTimeout   = if (cfg.hasPath("pingTimeout")) cfg.getInt("pingTimeout") else defaultConfig.pingTimeout
    val retryInterval = if (cfg.hasPath("retryInterval")) cfg.getInt("retryInterval") else defaultConfig.retryInterval
    val minReconnect  = if (cfg.hasPath("minReconnect")) cfg.getInt("minReconnect") else defaultConfig.minReconnect

    BlendedJMSConnectionConfig(pingTolerance, pingInterval, pingTimeout, retryInterval, minReconnect)
  }
}

case class BlendedJMSConnectionConfig(
  pingTolerance : Int,
  pingInterval : Int,
  pingTimeout : Int,
  retryInterval : Int,
  minReconnect : Int
)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy