Initial Commit
This commit is contained in:
parent
8696022889
commit
632e46c2a0
@ -30,10 +30,12 @@ public class AkkaHttpServer extends AllDirectives {
|
|||||||
|
|
||||||
AkkaHttpServer app = new AkkaHttpServer(system, userActorRef);
|
AkkaHttpServer app = new AkkaHttpServer(system, userActorRef);
|
||||||
|
|
||||||
final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = app.userRoutes.routes().flow(system, materializer);
|
final Flow<HttpRequest, HttpResponse, NotUsed> routeFlow = app.userRoutes.routes()
|
||||||
|
.flow(system, materializer);
|
||||||
|
|
||||||
final CompletionStage<ServerBinding> binding = Http.get(system).bindAndHandle(routeFlow,
|
final CompletionStage<ServerBinding> binding = Http.get(system)
|
||||||
ConnectHttp.toHost("localhost", 8080), materializer);
|
.bindAndHandle(routeFlow, ConnectHttp.toHost("localhost", 8080), materializer);
|
||||||
|
|
||||||
System.out.println("Server is online at http://localhost:8080/");
|
System.out.println("Server is online at http://localhost:8080/");
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package com.baeldung.akkahttp;
|
package com.baeldung.akkahttp;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines all messages related to User Actor
|
* Defines all messages related to User Actor
|
||||||
*
|
*
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.baeldung.akkahttp;
|
package com.baeldung.akkahttp;
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletionStage;
|
import java.util.concurrent.CompletionStage;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import com.baeldung.akkahttp.UserRegistryMessages.ActionPerformed;
|
||||||
|
import com.baeldung.akkahttp.UserRegistryMessages.CreateUser;
|
||||||
|
|
||||||
import akka.actor.ActorRef;
|
import akka.actor.ActorRef;
|
||||||
import akka.actor.ActorSystem;
|
import akka.actor.ActorSystem;
|
||||||
import akka.event.Logging;
|
import akka.event.Logging;
|
||||||
@ -16,6 +18,7 @@ import akka.http.javadsl.server.PathMatchers;
|
|||||||
import akka.http.javadsl.server.Route;
|
import akka.http.javadsl.server.Route;
|
||||||
import akka.pattern.PatternsCS;
|
import akka.pattern.PatternsCS;
|
||||||
import akka.util.Timeout;
|
import akka.util.Timeout;
|
||||||
|
import scala.concurrent.duration.Duration;
|
||||||
|
|
||||||
public class UserRoutes extends AllDirectives {
|
public class UserRoutes extends AllDirectives {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user