src/main/scala/CouchStream.scala
changeset 5 141e76d946e3
parent 4 b25c02bd6b11
equal deleted inserted replaced
4:b25c02bd6b11 5:141e76d946e3
    21 
    21 
    22   implicit object ChangesMarshaller extends Unmarshaller[ResultRow] {
    22   implicit object ChangesMarshaller extends Unmarshaller[ResultRow] {
    23     import DefaultJsonProtocol._
    23     import DefaultJsonProtocol._
    24     implicit val changesFormat = jsonFormat3(ResultRow)
    24     implicit val changesFormat = jsonFormat3(ResultRow)
    25 
    25 
    26     def apply(entity: HttpEntity): Deserialized[ResultRow] = (Try {
    26     def apply(entity: HttpEntity): Deserialized[ResultRow] = Try {
    27       Right(JsonParser(entity.asString).asJsObject.convertTo[ResultRow])
    27       Right(JsonParser(entity.asString(HttpCharsets.`UTF-8`)).asJsObject.
    28     }).getOrElse(Left(MalformedContent("bad json")))
    28         convertTo[ResultRow])
       
    29     } getOrElse Left(MalformedContent("bad json"))
    29 
    30 
    30   }
    31   }
    31 }
    32 }
    32 
    33 
    33 class ChangesStreamActor(processor: ActorRef) extends Actor with ActorLogging
    34 class ChangesStreamActor(processor: ActorRef) extends Actor with ActorLogging