camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thibaut Robert <thibaut.rob...@gmail.com>
Subject CxfRs producer: connection not closed
Date Wed, 26 Nov 2014 17:02:16 GMT
Hi,

When using cxfRs to send a rest message in InOnly mode, Camel do not close
the javax.ws.rs.core.Response object. As we are InOnly, the reponse object
is not passed through the exchange, so the caller can not close it either.

Not calling close on the response maintain the input stream open (and the
associated tcp connection) until it times out (or gc'ed), which is not
desirable.

As a workaround I always use InOut mode and close the response, even if I'm
not interested in the result.

Example (scala code):

val camel = new DefaultCamelContext().createProducerTemplate()
val destination = "http://localhost:1234"
val body = """{"key":"value"}"""
// Leave an open connection
//camel.sendBody("cxfrs:" + destination, body)
// use instead:
camel.requestBody("cxfrs:" + destination,
body).asInstanceOf[Response].close()


Is it possible to change this behaviour in Camel ?

Thanks

--
Thibaut

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message