Allow applications to disable stream-caching (#202)
This commit is contained in:
parent
9baedab597
commit
c2efd39661
3 changed files with 8 additions and 5 deletions
|
|
@ -75,10 +75,13 @@ trait CamelContextLifecycle extends Logging {
|
|||
def init: Unit = init(new DefaultCamelContext)
|
||||
|
||||
/**
|
||||
* Initializes this lifecycle object with the given CamelContext.
|
||||
* Initializes this lifecycle object with the given CamelContext. For the passed
|
||||
* CamelContext stream-caching is enabled. If applications want to disable stream-
|
||||
* caching they can do so after this method returned and prior to calling start.
|
||||
*/
|
||||
def init(context: CamelContext) {
|
||||
this.context = context
|
||||
this.context.setStreamCaching(true)
|
||||
this.template = context.createProducerTemplate
|
||||
_initialized = true
|
||||
log.info("Camel context initialized")
|
||||
|
|
|
|||
|
|
@ -35,9 +35,6 @@ trait CamelService extends Bootable with Logging {
|
|||
if (!initialized) init
|
||||
if (!started) start
|
||||
|
||||
// Camel should cache input streams
|
||||
context.setStreamCaching(true)
|
||||
|
||||
// start actor that exposes consumer actors via Camel endpoints
|
||||
consumerPublisher.start
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ class CamelContextLifecycleTest extends JUnitSuite with CamelContextLifecycle {
|
|||
@Test def shouldManageCustomCamelContext {
|
||||
assert(context === null)
|
||||
assert(template === null)
|
||||
init(new TestCamelContext)
|
||||
val ctx = new TestCamelContext
|
||||
assert(ctx.isStreamCaching === false)
|
||||
init(ctx)
|
||||
assert(context.isStreamCaching === true)
|
||||
assert(!context.asInstanceOf[TestCamelContext].isStarted)
|
||||
assert(!template.asInstanceOf[DefaultProducerTemplate].isStarted)
|
||||
start
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue