Closed mvbaffa closed 8 years ago
I sure apologize if the manual isn't clear on this point! This is something that takes getting used to because implicits are a foreign concept to most (every?) Scala newcomers.
You need to define an implicit Marshalling strategy. If you rolled your own, it would look something like this:
implicit val personMarshaller = new RabbitMarshaller[Person] {
val contentType = "text/plain"
protected val contentEncoding = Some("UTF-8")
private val utf8 = Charset.forName(encoding)
def marshall(value: Person) =
value.toString.getBytes(utf8) // just an example. Person.toString is not a good marshalling strategy.
}
The marshaller sets the appropriate message headers which are made unavailable to the unmarshaller.
You can also bring in bundled the play-json
or json4s
support, and then define a play-json
format, bring it in to scope, etc.
I'am trying to reproduce you manual, so:
It is connecting OK. But when I include the lines below I got a compiler error
Can you help me?