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

org.elasticmq.NodeBuilder.scala Maven / Gradle / Ivy

The newest version!
package org.elasticmq

import org.elasticmq.storage.{StorageCommandExecutor, StorageModule}
import org.elasticmq.impl.scheduler.BackgroundVolatileTaskSchedulerModule
import org.elasticmq.impl.{NowModule, NodeImpl}
import org.elasticmq.impl.nativeclient.NativeModule
import com.weiglewilczek.slf4s.Logging

object NodeBuilder extends Logging {
  def withStorage(storage: StorageCommandExecutor): Node = {
    val env = new NativeModule
      with NowModule
      with BackgroundVolatileTaskSchedulerModule
      with StorageModule {
      def storageCommandExecutor = storage
    }

    val node = new NodeImpl(env.nativeClient, () => storage.shutdown())

    logger.info("Started new node with storage %s".format(storage.getClass.getSimpleName))

    node
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy