Friday, February 16, 2018

Get Started with Lightbend Technologies

 Microservices framework built on Akka and Play
https://www.lightbend.com/lagom-framework

Lagom - Get started 
https://www.lagomframework.com/get-started-java-maven.html


Create project - choose name and package
https://developer.lightbend.com/start/?group=lagom&project=lagom-java-maven

Download project and add it into GitHub
[dave@localhost github]$ cp ~/Downloads/lagom-java-maven.zip .
[dave@localhost github]$ unzip -l lagom-java-maven.zip 
Archive:  lagom-java-maven.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  02-16-2018 21:42   lagom-java-maven/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/
     2536  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/resources/
       38  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/resources/application.conf
      346  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/resources/logback-test.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/dave/it/
     3043  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/integration-tests/src/test/java/org/dave/it/StreamIT.java
      130  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/.gitignore
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/
      734  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/stream/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/stream/api/
     1446  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-api/src/main/java/org/dave/stream/api/StreamService.java
     3277  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/
     2328  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/resources/
      404  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/resources/logback-test.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/impl/
     1858  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/impl/HelloEntityTest.java
     1179  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/test/java/org/dave/hello/impl/HelloServiceTest.java
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/resources/
      928  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/resources/application.conf
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/
     1838  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloCommand.java
     3488  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloEntity.java
     3119  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloServiceImpl.java
      442  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloModule.java
     1820  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloEvent.java
      726  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-impl/src/main/java/org/dave/hello/impl/HelloState.java
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/
     2385  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/resources/
      935  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/resources/application.conf
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/
     1221  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamServiceImpl.java
      710  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamModule.java
     1196  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamSubscriber.java
     1878  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/stream-impl/src/main/java/org/dave/stream/impl/StreamRepository.java
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/
     1051  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/pom.xml
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/
        0  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/
     1925  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/HelloService.java
      855  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/HelloEvent.java
      484  02-16-2018 21:42   lagom-java-maven/DaveLagomProject/hello-api/src/main/java/org/dave/hello/api/GreetingMessage.java
        0  02-16-2018 21:42   lagom-java-maven//
---------                     -------
    42320                     81 files


Created project on GitHub
https://github.com/dveselka/lagom-java-maven

 Build and run project
[dave@localhost DaveLagomProject]$ mvn lagom:runAll
[INFO] Scanning for projects...


[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] DaveLagomProject
[INFO] hello-api
[INFO] hello-impl
[INFO] stream-api
[INFO] stream-impl
[INFO] integration-test


Akka starting
[INFO] Compiling 6 source files to /home/dave/github/lagom-java-maven/DaveLagomProject/hello-impl/target/classes
22:57:48.601 [info] akka.event.slf4j.Slf4jLogger [] - Slf4jLogger started
22:57:49.941 [info] akka.remote.Remoting [sourceThread=ForkJoinPool-1-worker-1, akkaSource=akka.remote.Remoting, sourceActorSystem=hello-impl-application, akkaTimestamp=21:57:49.939UTC] - Starting remoting
22:57:50.865 [info] akka.remote.Remoting [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:50.864UTC, akkaSource=akka.remote.Remoting, sourceActorSystem=hello-impl-application] - Remoting started; listening on addresses :[akka.tcp://hello-impl-application@127.0.0.1:41899]
22:57:50.883 [info] akka.remote.Remoting [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:50.883UTC, akkaSource=akka.remote.Remoting, sourceActorSystem=hello-impl-application] - Remoting now listens on addresses: [akka.tcp://hello-impl-application@127.0.0.1:41899]
22:57:50.926 [info] akka.cluster.Cluster(akka://hello-impl-application) [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:50.926UTC, akkaSource=akka.cluster.Cluster(akka://hello-impl-application), sourceActorSystem=hello-impl-application] - Cluster Node [akka.tcp://hello-impl-application@127.0.0.1:41899] - Starting up...
22:57:51.084 [info] akka.cluster.Cluster(akka://hello-impl-application) [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:51.084UTC, akkaSource=akka.cluster.Cluster(akka://hello-impl-application), sourceActorSystem=hello-impl-application] - Cluster Node [akka.tcp://hello-impl-application@127.0.0.1:41899] - Registered cluster JMX MBean [akka:type=Cluster,port=41899]
22:57:51.085 [info] akka.cluster.Cluster(akka://hello-impl-application) [sourceThread=ForkJoinPool-1-worker-1, akkaTimestamp=21:57:51.084UTC, akkaSource=akka.cluster.Cluster(akka://hello-impl-application), sourceActorSystem=hello-impl-application] - Cluster Node [akka.tcp://hello-impl-application@127.0.0.1:41899] - Started up successfully


Service started
2:59:47.300 [info] akka.cluster.singleton.ClusterSingletonManager [sourceThread=stream-impl-application-akka.actor.default-dispatcher-17, akkaTimestamp=21:59:47.297UTC, akkaSource=akka.tcp://stream-impl-application@127.0.0.1:41263/user/cassandraOffsetStorePrepare-singleton, sourceActorSystem=stream-impl-application] - ClusterSingletonManager state change [Start -> Oldest]
22:59:47.301 [info] com.lightbend.lagom.internal.persistence.cluster.ClusterStartupTaskActor [sourceThread=stream-impl-application-akka.actor.default-dispatcher-13, akkaTimestamp=21:59:47.300UTC, akkaSource=akka.tcp://stream-impl-application@127.0.0.1:41263/user/cassandraOffsetStorePrepare-singleton/singleton/cassandraOffsetStorePrepare, sourceActorSystem=stream-impl-application] - Executing cluster start task cassandraOffsetStorePrepare.
22:59:47.655 [info] akka.cluster.singleton.ClusterSingletonProxy [sourceThread=stream-impl-application-akka.actor.default-dispatcher-17, akkaTimestamp=21:59:47.655UTC, akkaSource=akka.tcp://stream-impl-application@127.0.0.1:41263/user/cassandraOffsetStorePrepare-singletonProxy, sourceActorSystem=stream-impl-application] - Singleton identified at [akka://stream-impl-application/user/cassandraOffsetStorePrepare-singleton/singleton]
22:59:47.703 [info] play.api.http.EnabledFilters [] - Enabled Filters (see <https://www.playframework.com/documentation/latest/Filters>):


22:59:48.517 [info] play.api.Play [] - Application started (Dev)
[INFO] Service hello-impl listening for HTTP on 0:0:0:0:0:0:0:0:57797
[INFO] Service stream-impl listening for HTTP on 0:0:0:0:0:0:0:0:58445
[INFO] (Services started, press enter to stop and go back to the console..


Fresh  start
INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] DaveLagomProject
[INFO] hello-api
[INFO] hello-impl
[INFO] stream-api
[INFO] stream-impl
[INFO] integration-test
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building DaveLagomProject 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- lagom-maven-plugin:1.4.0:runAll (default-cli) @ DaveLagomProject ---
[INFO] Starting Kafka
[INFO] Detected Guava >= 19 in the classpath, using modern compatibility layer
[INFO] Starting Cassandra
.[INFO] Using native clock to generate timestamps.
[INFO] Did not find Netty's native epoll transport in the classpath, defaulting to NIO.
.[INFO] Using native clock to generate timestamps.
.[INFO] Using native clock to generate timestamps.


Verify service by calling

http://localhost:9000/api/hello/World










No comments:

Post a Comment