Skip to content

Commit 8bf3ca0

Browse files
author
Josh Devins
committed
Skeleton Spray service
1 parent 49dd3af commit 8bf3ca0

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

project/plugins/build.sbt

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11

2+
// eclipse
3+
resolvers += {
4+
val typesafeRepoUrl = new java.net.URL("http://repo.typesafe.com/typesafe/releases")
5+
val pattern = Patterns(false, "[organisation]/[module]/[sbtversion]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]")
6+
Resolver.url("Typesafe Repository", typesafeRepoUrl)(pattern)
7+
}
8+
9+
libraryDependencies <+= (sbtVersion) { v => "com.typesafe.sbteclipse" %% "sbteclipse" % "1.3-RC3" extra("sbtversion" -> v) }
10+
11+
// assembly -- https://github.com/eed3si9n/sbt-assembly
12+
libraryDependencies <+= (sbtVersion) { v => "com.eed3si9n" %% "sbt-assembly" % ("sbt" + v + "_0.6") }
13+
214
// akka -- https://github.com/jboner/akka/tree/master/akka-sbt-plugin
315
libraryDependencies ++= Seq(
416
"se.scalablesolutions.akka" % "akka-sbt-plugin" % "1.1.3"
517
)
618

719
// web -- https://github.com/siasia/xsbt-web-plugin
820
libraryDependencies <+= (sbtVersion) { v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.0-" + v) }
9-
10-
// assembly -- https://github.com/eed3si9n/sbt-assembly
11-
libraryDependencies <+= (sbtVersion) { v => "com.eed3si9n" %% "sbt-assembly" % ("sbt" + v + "_0.6") }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package net.joshdevins.gis.geocoder
2+
3+
import akka.config.Supervision._
4+
import akka.actor.Supervisor
5+
import akka.actor.Actor._
6+
import cc.spray._
7+
import utils.ActorHelpers._
8+
9+
class Boot {
10+
11+
val mainModule = new ReverseGeocoderService {
12+
// bake your module cake here
13+
}
14+
15+
// start the root service actor (and any service actors you want to specify supervision details for)
16+
Supervisor(
17+
SupervisorConfig(
18+
OneForOneStrategy(List(classOf[Exception]), 3, 100),
19+
List(
20+
Supervise(actorOf[RootService], Permanent))))
21+
22+
// attach an HttpService (which is also an actor)
23+
// the root service automatically starts the HttpService if it is unstarted
24+
actor[RootService] ! Attach(HttpService(mainModule.reverseGeocoderService))
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package net.joshdevins.gis.geocoder
2+
3+
import cc.spray._
4+
5+
trait ReverseGeocoderService extends Directives {
6+
7+
val reverseGeocoderService = {
8+
path("") {
9+
get { _.complete("Say hello to Spray!") }
10+
}
11+
}
12+
13+
}

0 commit comments

Comments
 (0)