This is a gRPC based application in Scala demonstrating how IoT device states get algorithmically updated as streaming requests/responses using Akka gRPC, which is built on top of Akka Streams and Akka HTTP with HTTP/2 transport.
Akka gRPC generates:
- service interfaces from a Protobuf service schema that get implemented as Scala classes and Akka stream components on top of a Akka-HTTP server that supports HTTP/2
- gRPC stubs through implementing the service interfaces with Akka Streams API for the gRPC clients to invoke the remote services
For an overview of the application, please visit Genuine Blog.
To run the server application, open a command line terminal, go to the project-root and and run as follows:
On terminal #1
sbt "runMain akkagrpc.IotStreamServer"
For the client application, IotStreamClient takes the following parameters:
IotStreamClient clientId broadcastYN propIdStart propIdEnd
# e.g. IotStreamClient client1 1 1000 1049 # broadcastYN: 1=Yes | 0=No
To run the client application, open a terminal for each client, go to the project-root and run a specific range of IDs of real estate properties:
On terminal #2
sbt "runMain akkagrpc.IotStreamClient client1 1 1000 1019"
On terminal #3
sbt "runMain akkagrpc.IotStreamClient client2 1 1020 1039"