294.2. SCR 中的 AbstractCamelRunner 的生命周期
-
当组件的配置策略和强制引用满足 SCR 调用
activate ()
时。这会通过以下调用链创建和设置 CamelContext:activate ()
→prepare ()
→createCamelContext ()
→setupPropertiesComponent ()
→configure ()
→setupCamelContext ()
。最后,上下文会在AbstractCamelRunner.START_DELAY
中定义的延迟之后启动,并带有runWithDelay ()
。 -
当 Camel 组件(
componentResolver
服务)在 OSGi 中注册时,SCR 调用 getCamelComponent'()'(CamelComponent'
()'),CamelComponent'()' 将在同一个AbstractCamelRunner.START_DELAY
开始更多。这会导致 CamelContext 在加载所有 Camel 组件或两者之间有足够的空白处等待。同一逻辑将告知在我们添加更多 CamelContext 时尝试失败的 CamelContext。 -
When Camel components are unregistered SCR calls
lostCamelComponent`
()`.这个调用不会进行任何操作。 -
当导致调用
激活
时。这将关闭 CamelContext。()
的要求之一是 SCR 将停用
()
在 (非OSGi)单元测试,您应该使用 prepare ()
→ run ()
→ stop ()
而不是 activate ()
→ deactivate ()