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

com.github.jeanadrien.gatling.mqtt.client.Callback.scala Maven / Gradle / Ivy

The newest version!
package com.github.jeanadrien.gatling.mqtt.client

import com.typesafe.scalalogging.StrictLogging

/**
  *
  */
private[client] object Callback extends StrictLogging {

    class HalfCallback[T](val onSuccessFn : T => Unit) {

        def onFailure(onFailureFn : Throwable => Unit) = new org.fusesource.mqtt.client.Callback[T] {

            override def onSuccess(void : T) : Unit = onSuccessFn(void)

            override def onFailure(value : Throwable) : Unit = onFailureFn(value)
        }
    }

    def onSuccess[T](onSuccessFn : T => Unit) = new HalfCallback[T](onSuccessFn)

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy