Last active
August 29, 2015 14:12
-
-
Save maxant/e521d4745bf3083c1cd9 to your computer and use it in GitHub Desktop.
Main program, setting up Spray and Akka
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final ActorSystem system = ActorSystem.create("system"); | |
public static void main(String[] args) { | |
... | |
ActorRef listener = system.actorOf(Props.create(HttpActor.class), "httpActor"); | |
InetSocketAddress endpoint = new InetSocketAddress(3000); | |
int backlog = 100; | |
List<Inet.SocketOption> options = JavaConversions.asScalaBuffer(new ArrayList<Inet.SocketOption>()).toList(); | |
Option<ServerSettings> settings = scala.Option.empty(); | |
ServerSSLEngineProvider sslEngineProvider = null; | |
Bind bind = new Http.Bind(listener, endpoint, backlog, options, settings, sslEngineProvider); | |
IO.apply(spray.can.Http$.MODULE$, system).tell(bind, ActorRef.noSender()); | |
system.scheduler().schedule(new FiniteDuration(5, TimeUnit.SECONDS), new FiniteDuration(5, TimeUnit.SECONDS), ()->{ | |
System.out.println(new Date() + " - numSales=" + numSales.get()); | |
}, system.dispatcher()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment