uralian / sdk-dslink-scala   0.6.1

Apache License 2.0 GitHub

Scala-based implementation of DSA SDK for dslinks

Scala versions: 2.12


build status coverage status

DSLink SDK for Scala


  • Provides DSAConnector and DSAConnection classes as a communication facade.
  • Tracks DSA connection lifecycle through DSAEventListener interface.
  • Implements DSAHelper object for basic DSA operations, such as invoke, subscribe, set, etc.
  • Exposes DSA API through Reactive Streams paradigm.
  • Implements fluent Scala layer to facilitate operations with DSA artifacts.
  • Recognizes all existing Node API data types.

Essential Information


The license is Apache 2.0, see LICENSE.

Binary Releases

You can find published releases on Maven Central.


sbt dependency:

libraryDependencies += "com.uralian" %% "sdk-dslink-scala_2.12" % "0.6.1"

Gradle dependency:

compile group: 'com.uralian', name: 'sdk-dslink-scala_2.12', version: '0.6.1'

API Docs

The complete Scaladoc bundle is available online at github.io.



You can create a DSAConnector passing individual settings or the entire argument list:

val brokerUrl = ...
val configPath = ...
val connector = DSAConnector("-b", brokerUrl, "-d", configPath)


def main(args: Array[String]): Unit = {
  val connector = DSAConnector(args)

You can then add listeners and initiate a new connection do DSA:

connector.addListener(new DSAEventListener {
  override def onResponderConnected(link: DSLink) = println("responder link connected @ " + link.getPath)
val connection = connector.start(RESPONDER)
val root = connection.responderLink.getNodeManager.getSuperRoot
root createChild "counter" valueType ValueType.NUMBER value 0 build ()


Most DSAHelper methods require implicit Requester or Responder object. You can use the ones provided by DSAConnection:

val connection = connector start LinkMode.DUAL
implicit val requester = connection.requester
implicit val responder = connection.responder

Example calling DSA Invoke method:

DSAHelper invoke (path, key1 -> value1, key2 -> value2) subscribe (
	onNext = event => println("Event received: " + event),
    onError = err => println("Error occurred: " + err),
    onCompleted = () => println("Stream closed, no more data")

Example calling DSA Subscribe on multiple nodes and merging the results:

val cpu = DSAHelper watch "/downstream/System/CPU_Usage"
val mem = DSAHelper watch "/downstream/System/Memory_Usage"
cpu merge mem subscribe { sv =>
	println(sv.getPath + " : " + sv.getValue)

Note that you can subscribe to the same path multiple times using watch without raising an error.

Node Builder

This SDK also provides an extension to the Java NodeBuilder class to expose a simple DSL.

Example creating new nodes:

parentNode createChild "changeValue" display "Update Value" action (
		parameters = List("value" -> ValueType.NUMBER),
    	handler = result => {
      		val value = result.getParameter("value").getNumber
			DSAHelper updateNode "/output/value" -> value
) build