Reputation: 1101
Starting with:
http://www.typesafe.com/activator/template/camel-http
I have made a simple route:
import org.apache.camel.scala.dsl.builder.RouteBuilder
class SocketPost extends RouteBuilder {
"""netty:tcp://localhost:12000""" ==> {
id("hello socket")
log("hello")
to("http4:localhost:9000/")
}
}
and added it:
context.setUseMDCLogging(true)
context.addRoutes(new SocketPost())
context.start()
I can telnet to localhost:12000 and type in some data and disconnect, but my google skills fails me as to how to process the data. I only get a log when I connect:
09:48:43 DEBUG org.apache.camel.component.netty.DefaultServerPipelineFactory Using OrderedMemoryAwareThreadPoolExecutor with core pool size: 16
otherwise all is silent. I would like the data typed in via telnet to be POSTED to localhost:9000 as in the tutorial.
Upvotes: 0
Views: 120
Reputation: 55555
The netty component is not text based by default, but using java object serialization. That was because the other by older tcp components camel-mina had that default behavior, and we wanted netty be be similar.
So you need to configure the endpoint as text based by setting the option textline=true
. You can find more details about this option at: http://camel.apache.org/netty
Upvotes: 1