[
https://issues.apache.org/jira/browse/CAMEL-12610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16552107#comment-16552107
]
Jan Bednar edited comment on CAMEL-12610 at 7/22/18 6:11 PM:
-------------------------------------------------------------
The next thing. Right now, it looks, there is no way of using process EIP (as
suggested by Claus), in dynamic way and without cache.
{{.processRef("something")}}, {{.process("something")}}, {{.to("something")}},
{{.toD("${header.destination}")}},
{{.recipientList(simple(${header.destination}))}} and {{dynamicRouter}}. All of
these methods invokes cached bean instance with header
{{destination="something"}}.
was (Author: bedla):
The next thing. Right now, it looks, there is no way of using process EIP (as
suggested by Claus), in dynamic way and without cache.
{{.processRef("something}")}}, {{.process("something}")}},
{{.to("something}")}}, {{.toD("${header.destination}")}},
{{.recipientList(simple(${header.destination}))}} and {{dynamicRouter}}. All of
these methods invokes cached bean instance with header
{{destination="something"}}.
> Camel bean component invokes cached instance of bean (that impl processor) in
> Registry
> --------------------------------------------------------------------------------------
>
> Key: CAMEL-12610
> URL: https://issues.apache.org/jira/browse/CAMEL-12610
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.20.3, 2.21.1, 2.22.0
> Environment: N/A
> Reporter: Jan Bednar
> Assignee: Willem Jiang
> Priority: Minor
> Attachments: Referring objects for originalInstance.png, Stack during
> second invocation of SomeDependentBean.txt
>
>
> Related SO question:
> [https://stackoverflow.com/questions/51108913/camel-bean-component-invokes-cached-instance-of-named-dependent-bean]
> Every invocation of bean component should query Registry for actual instance.
> Now it is cached in {{BeanProcessor#delegate}} variable, even if endpoint
> parameter {{cache=false}} specified.
> This behavior breaks java-ee compliance:
> [https://docs.oracle.com/javaee/7/api/javax/enterprise/context/Dependent.html]
> {quote}Every invocation of the [{{Context.get(Contextual,
> CreationalContext)}}|https://docs.oracle.com/javaee/7/api/javax/enterprise/context/spi/Context.html#get-javax.enterprise.context.spi.Contextual-javax.enterprise.context.spi.CreationalContext-]
> operation of the context object for the {{@Dependent}} scope returns a new
> instance of the given bean.
> {quote}
> Marking this as Major, because upgrading of Camel from 2.19.x to 2.2x.x leads
> to unpredictable results in CDI environment. Since this is tied to CDI
> environment, this issue is hard to notice even in well junit covered
> application and can result in major issues in pre-production or production
> environment.
> Full reproducible project with unit test and deployable WAR package, which
> passes with 2.19.x and lower. Fails with 2.20.x and higher [on
> Github|https://github.com/bedlaj/camel-dependent-bean].
> Attachments are based on version 2.21.1
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)