Most applications we build are web-based. To get a feel for the current state of rich client applications, this session’s speaker and his colleagues decided to rebuild a Lego train front end with the NetBeans RCP. The Lego train is equipped with a Raspberry Pi, camera, wireless dongle, infrared transmitter, speaker, RFID reader, and battery pack. There are also automated switch tracks and cameras, again with the help of Raspberry Pi’s. To control the train and other parts, they built an actor-based application with Scala, Akka, Akka HTTP, and the NetBeans RCP. The presentation explains how you can build this yourself; describes their NetBeans RCP experiences and challenges; and, of course, includes a live demo.
8. MINIMAL INGREDIENTS FOR 1TRAIN
ABOUT € 50
Raspberry Pi A+ / Raspberry Pi Zero
Wifi dongle
EDUP Ultra-Mini Nano USB 2.0 802.11n
USB battery pack
Anker® 2. Gen Astro Mini 3200mAh
Infrared transmitter
Keyes 38KHz IR InfraredTransmitter Module for
Arduino
40. AKKA ACTORS
class Worker extends Actor {
def receive = {
case x =>
println(x)
}
}
val system = ActorSystem("ExampleActorSystem")
val workerActorRef = system.actorOf(Props[Worker])
workerActorRef ! "Hello conference"
43. AKKA REMOTE ACTOR CALL
val workerActorRef =
system.actorOf(Props[Worker])
val workerActorRef =
system.actorSelection("akka.tcp://
ExampleActorSystem@127.0.0.1:9005
/user/workerActor")
44. AKKA REMOTE ACTOR CONFIGURATION
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 9002
}
}
}
50. MESSAGE USED BY APPLICATION
val actorRef = context.actorSelection(
"akka.tcp://[Actorsystem]@
[IP]:[port]/user/musicservice")
actorRef !
[packagename].MusicServiceMessage.Play(filename)