Packages

  • package root
    Definition Classes
    root
  • package akka
    Definition Classes
    root
  • package wamp

    Contains classes, traits, types and functions to be used to write applications based on WAMP - Web Application Messaging Protocol

    Contains classes, traits, types and functions to be used to write applications based on WAMP - Web Application Messaging Protocol

    Client

    Akka Wamp provides you with three distinct Client APIs in the wamp.client package

    • Actor based
    • Future based
    • Stream based

    Router

    Akka Wamp provides you with a basic router implementation in the wamp.router package

    Definition Classes
    akka
  • package client

    Contains classes, traits, types and functions to be used to implement WAMP clients in Scala.

    Contains classes, traits, types and functions to be used to implement WAMP clients in Scala.

    Please refer to the official Akka Wamp User's Guide published online for further details.

    Actors

    Is the low level Client API.

    Futures

    Is the high level Client API

    import akka.actor._
    import akka.wamp.client._
    import com.typesafe.config._
    
    val config = ConfigFactory.load("my.conf")
    val system = ActorSystem("myapp", config)
    val client = Client(system)
    
    client.connect("myrouter").foreach { conn =>
      conn.open("myrealm").foreach { implicit s =>
    
        publish("mytopic", List("paolo", 99))
    
        subscribe("mytopic", (name: String, age: Int) = {
          println(s"$name is $age years old")
        }
    
        call("myprocedure", List("paolo", 99))
    
        register("myprocedure", (name: String, age: Int) => {
          name.length + age
        })
      }
    }

    Streams

    TBD

    Definition Classes
    wamp
    See also

    akka.wamp.client.japi for Java API

  • package japi

    Contains classes to implement clients in Java.

    Contains classes to implement clients in Java.

    ...
    Note

    Java API

    See also

    akka.wamp.client

  • Client
  • ClientActor
  • ClientException
  • Connection
  • Macros
  • Publication
  • Registration
  • Session
  • Subscription
  • package messages
    Definition Classes
    wamp
  • package router
    Definition Classes
    wamp
  • package serialization
    Definition Classes
    wamp
p

akka.wamp

client

package client

Contains classes, traits, types and functions to be used to implement WAMP clients in Scala.

Please refer to the official Akka Wamp User's Guide published online for further details.

Actors

Is the low level Client API.

Futures

Is the high level Client API

import akka.actor._
import akka.wamp.client._
import com.typesafe.config._

val config = ConfigFactory.load("my.conf")
val system = ActorSystem("myapp", config)
val client = Client(system)

client.connect("myrouter").foreach { conn =>
  conn.open("myrealm").foreach { implicit s =>

    publish("mytopic", List("paolo", 99))

    subscribe("mytopic", (name: String, age: Int) = {
      println(s"$name is $age years old")
    }

    call("myprocedure", List("paolo", 99))

    register("myprocedure", (name: String, age: Int) => {
      name.length + age
    })
  }
}

Streams

TBD

See also

akka.wamp.client.japi for Java API

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. client
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class Client extends Peer

    Represents a client.

    Represents a client.

    Instances can be created using its companion object.

    val client = ...
    
    val session =
      for {
        conn <- client.connect("myrouter")
        session <- conn.open("myrealm")
      }
      yield(session)
    See also

    akka.wamp.client.japi.Client

  2. trait ClientActor extends Actor with SessionIdScope
  3. case class ClientException (message: String, cause: Throwable) extends Throwable with Product with Serializable

    Represents an error

  4. class Connection extends wamp.Connection

    Represents a connection established by a client to a router.

    Represents a connection established by a client to a router.

    Instances can be obtained by invoking the Client!.connect()* method.

    val client = ...
    val conn =
      client.connect("myrouter")

    Named transports can be configured as follows:

    akka.wamp.client.transport {
      myrouter {
        url = "wss://router.host.net:8443/wamp"
        format = "msgpack"
        min-backoff = 3 seconds
        max-backoff = 30 seconds
        random-factor = 0.2
      }
    }

    Once connected you can open a Session.

    val session =
      conn.flatMap(c => c.open("myrealm"))
  5. class Publication extends AnyRef

    Is an acknowledged publication.

    Is an acknowledged publication.

    Instance are obtained by invoking the Session.publish method

    val publication: Future[Subscription] =
      session.flatMap { s =>
        s.publishAck("mytopic", List("paolo", 40))
      }
    
    publication.onComplete {
      case Success(pb) =>
        log.info("Published to {} with {}", pb.topic, pb.id)
      case Failure(ex) =>
        log.warning("Not published because of {}", ex.getMessage)
    }
    See also

    akka.wamp.client.japi.Publication

  6. class Registration extends AnyRef

    Represents an acknowledged registration.

    Represents an acknowledged registration.

    Instance are obtained by invoking the Session.register method

    val registration: Future[Registration] =
      session.flatMap { s =>
        s.register("myprocedure", invocation => {
          // handle invocation ...
          // return future of payload ...
        })
      }
    
    registration.onComplete {
      case Success(rg) =>
        log.info("Registered {} with {}", rg.procedure, rg.id)
      case Failure(ex) =>
        log.warning("Not registered because of {}", ex.getMessage)
    }
    See also

    akka.wamp.client.japi.Registration

  7. class Session extends wamp.Session with SessionIdScope

    Represents a session attached to a realm.

    Represents a session attached to a realm.

    Open

    Instances are created either by invoking the Connection.open or the Client.open method

    val conn: Future[Connection] = ...
    val session: Future[Session] = conn.flatMap(c => c.open("myrealm"))

    Topics

    Once the session is open, you can publish to topics.

    val publication: Future[Publication] =
      session.flatMap { s =>
        s.publish("mytopic", List("paolo", 40))
      }

    Or you can subscribe event consumers to topics.

    val subscription: Future[Subscription] =
      session.flatMap { s =>
        s.subscribe("mytopic", event => {
          val publicationId = event.publicationId
          val subscriptionId = event.subscriptionId
          val details = event.details
          val payload = event.payload
          // consume payload content ...
        })
      }

    Procedures

    Once opened, you can call procedures.

    val result: Future[Result] =
      session.flatMap(s => s.call("myprocedure", List("paolo", 99)))

    Or you can register invocation handlers as procedures.

    val registration: Future[Registration] =
      session.flatMap { s =>
        s.register("myprocedure", invocation => {
          val registrationId = invocation.registrationId
          val details = event.details
          val payload = event.payload
          // handle payload content ...
          // return future of payload ...
        })
      }

    Macros

    You can subscribe/register lambda consumers/handlers to make your code look more functional ;-)

    val subscription: Future[Subscription] =
      session.flatMap { implicit s =>
    
        publish("mytopic", List("paolo", 40))
    
        subscribe("mytopic", (name: String, age: Int) => {
          println(s"$name is $age years old")
        })
    
        register("myprocedure", (name: String, age: Int) => {
          name.length + age
        })
      }
    See also

    akka.wamp.client.japi.Session

    akka.wamp.client.Macros

    akka.wamp.messages.DataConveyor

    akka.wamp.client

  8. class Subscription extends AnyRef

    Represents an acknowledged subscription.

    Represents an acknowledged subscription.

    Instance are obtained by invoking the Session.subscribe method

    val subscription: Future[Subscription] =
      session.flatMap { s =>
        s.subscribe("mytopic", event => {
          // consume event ...
        })
      }
    
    subscription.onComplete {
      case Success(sb) =>
        log.info("Subscribed to {} with {}", sb.topic, sb.id)
      case Failure(ex) =>
        log.warning("Not subscribed because of {}", ex.getMessage)
    }
    See also

    akka.wamp.client.japi.Subscription

Value Members

  1. def call(procedure: Uri, kwargs: Map[String, Any])(implicit session: Session): Future[Result]

    Calls the given procedure with the given dictionary of named arguments

    Calls the given procedure with the given dictionary of named arguments

    procedure

    is the procedure to be called

    kwargs

    the dictionary of named arguments

    session

    is the session

    returns

    the (future of) result

  2. def call(procedure: Uri, args: List[Any])(implicit session: Session): Future[Result]

    Calls the given procedure with the given list of indexed arguments

    Calls the given procedure with the given list of indexed arguments

    procedure

    is the procedure to be called

    args

    the list of indexed arguments

    session

    is the session

    returns

    the (future of) result

  3. def call(procedure: Uri)(implicit session: Session): Future[Result]

    Calls the given procedure

    Calls the given procedure

    procedure

    is the procedure to be called

    session

    is the session

    returns

    the (future of) result

  4. def publish(topic: Uri, args: List[Any])(implicit session: Session): Unit

    Publish to a topic (fire and forget)

    Publish to a topic (fire and forget)

    topic

    is the topic to publish to

    args

    is the list of indexed arguments to be published

  5. def publish(topic: Uri, kwargs: Map[String, Any])(implicit session: Session): Unit

    Publish to a topic (fire and forget)

    Publish to a topic (fire and forget)

    topic

    is the topic to publish to

    kwargs

    is the dictionary of named arguments to be published

  6. def publish(topic: Uri)(implicit session: Session): Unit

    Publish to a topic (fire and forget)

    Publish to a topic (fire and forget)

    topic

    is the topic to publish to

  7. macro def register[T1, T2, T3, T4, R](procedure: Uri, lambda: (T1, T2, T3, T4) ⇒ R): Future[Registration]

    Subscribe a 4-parameters lambda handler as the given procedure.

    Subscribe a 4-parameters lambda handler as the given procedure.

    procedure

    is the procedure to register as

    lambda

    is the lambda handler to register

    returns

    the (future) of registration

  8. macro def register[T1, T2, T3, R](procedure: Uri, lambda: (T1, T2, T3) ⇒ R): Future[Registration]

    Subscribe a 3-parameters lambda handler as the given procedure.

    Subscribe a 3-parameters lambda handler as the given procedure.

    procedure

    is the procedure to register as

    lambda

    is the lambda handler to register

    returns

    the (future) of registration

  9. macro def register[T1, T2, R](procedure: Uri, lambda: (T1, T2) ⇒ R): Future[Registration]

    Subscribe a 2-parameters lambda handler as the given procedure.

    Subscribe a 2-parameters lambda handler as the given procedure.

    procedure

    is the procedure to register as

    lambda

    is the lambda handler to register

    returns

    the (future) of registration

  10. macro def register[T1, R](procedure: Uri, lambda: (T1) ⇒ R): Future[Registration]

    Subscribe a 1-parameter lambda handler as the given procedure.

    Subscribe a 1-parameter lambda handler as the given procedure.

    procedure

    is the procedure to register as

    lambda

    is the lambda handler to register

    returns

    the (future) of registration

  11. macro def register[R](procedure: Uri, lambda: () ⇒ R): Future[Registration]

    Subscribe a 0-parameters lambda handler as the given procedure.

    Subscribe a 0-parameters lambda handler as the given procedure.

    procedure

    is the procedure to register as

    lambda

    is the lambda handler to register

    returns

    the (future) of registration

  12. macro def subscribe[T1, T2, T3, T4](topic: Uri, lambda: (T1, T2, T3, T4) ⇒ Unit): Future[Subscription]

    Subscribe a 4-parameters lambda consumer to the given topic.

    Subscribe a 4-parameters lambda consumer to the given topic.

    topic

    is the topic to subscribe to

    lambda

    is the lambda consumer to subscribe

    returns

    the (future) of subscription

  13. macro def subscribe[T1, T2, T3](topic: Uri, lambda: (T1, T2, T3) ⇒ Unit): Future[Subscription]

    Subscribe a 3-parameters lambda consumer to the given topic.

    Subscribe a 3-parameters lambda consumer to the given topic.

    topic

    is the topic to subscribe to

    lambda

    is the lambda consumer to subscribe

    returns

    the (future) of subscription

  14. macro def subscribe[T1, T2](topic: Uri, lambda: (T1, T2) ⇒ Unit): Future[Subscription]

    Subscribe a 2-parameters lambda consumer to the given topic.

    Subscribe a 2-parameters lambda consumer to the given topic.

    topic

    is the topic to subscribe to

    lambda

    is the lambda consumer to subscribe

    returns

    the (future) of subscription

  15. macro def subscribe[T](topic: Uri, lambda: (T) ⇒ Unit): Future[Subscription]

    Subscribe a 1-parameter lambda consumer to the given topic.

    Subscribe a 1-parameter lambda consumer to the given topic.

    topic

    is the topic to subscribe to

    lambda

    is the lambda consumer to subscribe

    returns

    the (future) of subscription

  16. macro def subscribe(topic: Uri, lambda: () ⇒ Unit): Future[Subscription]

    Subscribe a 0-parameters lambda consumer to the given topic.

    Subscribe a 0-parameters lambda consumer to the given topic.

    topic

    is the topic to subscribe to

    lambda

    is the lambda consumer to subscribe

    returns

    the (future) of subscription

  17. object Client

    Factory for Client instances.

    Factory for Client instances.

    import akka.actor._
    import akka.wamp.client._
    import com.typesafe.config._
    
    val config = ConfigFactory.load("my.conf")
    val system = ActorSystem("myapp", config)
    val client = Client(system)

    The client factory requires you to pass an ActorSystem properly named and configured via a Configuration.

    See also

    akka.wamp.client.japi.Client

  18. object Macros

    Provides implementations for macros

    Provides implementations for macros

    Subscribe

    val session: Future[Session] = ....
    session.flatMap { implicit s =>
      subscribe("mytopic", (name: String, age: Int) => {
        println(s"$name is $age years old")
      })
    }

    Register

    val session: Future[Session] = ....
    session.flatMap { implicit s =>
      register("myprocedure", (name: String, age: Int) => {
        name.length + age
      })
    }

Inherited from AnyRef

Inherited from Any

Ungrouped