Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
import org.apache.pekko.cluster.ClusterEvent;
import org.apache.pekko.cluster.typed.Cluster;
import org.apache.pekko.cluster.typed.Subscribe;
import org.apache.pekko.http.javadsl.ConnectHttp;
import org.apache.pekko.http.javadsl.Http;
import org.apache.pekko.management.cluster.bootstrap.ClusterBootstrap;
import org.apache.pekko.management.scaladsl.PekkoManagement;
import org.apache.pekko.stream.Materializer;

import static org.apache.pekko.http.javadsl.server.Directives.*;

Expand Down Expand Up @@ -44,10 +42,8 @@ static class Guardian {
public static Behavior<Void> create() {
return Behaviors.setup(context -> {
final org.apache.pekko.actor.ActorSystem classicSystem = Adapter.toClassic(context.getSystem());
Materializer mat = Materializer.matFromSystem(classicSystem);

Http.get(classicSystem).bindAndHandle(complete("Hello world")
.flow(classicSystem, mat), ConnectHttp.toHost("0.0.0.0", 8080), mat)
Http.get(classicSystem).newServerAt("0.0.0.0", 8080).bind(complete("Hello world"))
.whenComplete((binding, failure) -> {
if (failure == null) {
classicSystem.log().info("HTTP server now listening at port 8080");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public AdjustItemQuantity(String itemId, int quantity, ActorRef<StatusReply<Summ
/**
* A command to get the current state of the shopping cart.
*
* The reply type is the {@link Summary}
* The reply type is the {@link ShoppingCart.Summary}
*/
public static class Get implements Command {
public final ActorRef<Summary> replyTo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
import org.apache.pekko.actor.CoordinatedShutdown;
import org.apache.pekko.actor.typed.ActorSystem;
import org.apache.pekko.actor.typed.javadsl.Adapter;
import org.apache.pekko.http.javadsl.ConnectHttp;
import org.apache.pekko.http.javadsl.Http;
import org.apache.pekko.http.javadsl.server.Route;
import org.apache.pekko.stream.Materializer;
import org.apache.pekko.stream.SystemMaterializer;

import java.net.InetSocketAddress;
import java.time.Duration;
Expand All @@ -19,13 +16,8 @@ final class WeatherHttpServer {
public static void start(Route routes, int port, ActorSystem<?> system) {
org.apache.pekko.actor.ActorSystem classicActorSystem = Adapter.toClassic(system);

Materializer materializer = SystemMaterializer.get(system).materializer();

Http.get(classicActorSystem).bindAndHandle(
routes.flow(classicActorSystem, materializer),
ConnectHttp.toHost("localhost", port),
materializer
).whenComplete((binding, failure) -> {
Http.get(classicActorSystem).newServerAt("localhost", port).bind(routes)
.whenComplete((binding, failure) -> {
if (failure == null) {
final InetSocketAddress address = binding.localAddress();
system.log().info(
Expand Down
Loading