Closed Mindtoeye closed 7 years ago
We just release 0.9, but the docs are currently being rewritten. If you want those examples to work, use 0.8.4. New docs should be ready in a week or two.
Yeah there weren't too many API changes in 0.9, but HttpService was one of them.
If you want to see some working example code using 0.9.0, check out the examples sub-project, particularly the http example. You'll see there aren't too many changes you need to make to your code, but don't hesitate to ask if something still isn't working.
I'm specifically using HttpService because I can't get any of the other examples to work in my code and I've wasted almost a week now to get anything to work reliable in my Spark application. Right now all I care about it something that works and is compatible with 2.11
Apologies for the confusion, as Ben said we recently pushed out a major release that made a few breaking changes, and the docs have not yet been updated.
If you want to get your code working right now, all you need to do is change your dependency version from "0.9.0" to "0.8.4".
libraryDependencies += "com.tumblr" % "colossus_2.11" % "0.8.4"
The example code on the website and all the scaladocs are based on that version.
I switched back to 0.8.4, now I'm getting:
[info] Compiling 30 Scala sources to /Users/vvelsen/Desktop/Martin/CMU/CMLH/code/cmlh-pipeline/spark/scala-microservice/target/scala-2.11/classes...
[error] /Users/vvelsen/Desktop/Martin/CMU/CMLH/code/cmlh-pipeline/spark/scala-microservice/src/main/scala/edu/cmu/compbio/CMLHMicroService.scala:39: could not find implicit value for parameter sys: akka.actor.ActorSystem
[error] implicit val io_system = IOSystem()
[error] ^
[error] /Users/vvelsen/Desktop/Martin/CMU/CMLH/code/cmlh-pipeline/spark/scala-microservice/src/main/scala/edu/cmu/compbio/CMLHMicroService.scala:41: value become is not a member of object colossus.service.Service
[error] Service.become[Http]("scala-spark-microservice", HTTPPort) {
[error] ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 2 s, completed Aug 1, 2017 10:59:03 AM
In my source file I have:
import colossus.IOSystem
import colossus._
import core._
import service._
import protocols.http._
import UrlParsing._
import HttpMethod._
import akka.actor.ActorSystem
import colossus.protocols.http.QueryParameters
def someMethod ...
implicit val io_system = IOSystem()
Service.become[Http]("scala-spark-microservice", HTTPPort) {
.
.
.
So for the first error you just need to have an implicit ActorSystem
in scope. If you look in the first example code you posted, an ActorSystem
is created right before creating the IOSystem
.
For the second error, I believe you want to be doing Service.basic
, not Service.become
. Scaladoc here.
FYI latest docs have been published http://tumblr.github.io/colossus/0.9.0/
I'm trying the following code directly from the website and the compiler tells me there is no such thing as HttpService. According to the API documentation at:
https://tumblr.github.io/colossus/api/index.html#colossus.protocols.http.package$$HttpService
it should be in package:
colossus.protocols.http
In my SBT I'm using:
libraryDependencies += "com.tumblr" % "colossus_2.11" % "0.9.0"
I checked manually but that class is nowhere to be found in the jar file
Example code directly from the website: