Using dynamic expression as claimCheck key

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using dynamic expression as claimCheck key

jpcook01
Hi,

I'm trying to use the claimCheck but pass a dynamic key which would be
something unique like the filename in my input message or the
breadcrumbId. But it seems this processor doesn't support this?

e.g)
.claimCheck(ClaimCheckOperation.Set, "${headers.CamelFileName}", "body")

Is there a way to use the simple method e.g)
simple("${headers.CamelFileName}") but evaluate the expression at run
time?

Later I see another issue unrelated with this claimcheck definition, I
always see this error which is unrelated to my route definition:
2019-05-29 15:38:57,698 3899 [main] WARN  
o.a.c.m.ManagedManagementStrategy - Cannot check whether the managed
object is registered. This exception will be ignored.$
java.lang.ClassCastException:
org.apache.camel.model.ClaimCheckDefinition cannot be cast to
org.apache.camel.model.ExpressionNode$
^Iat
org.apache.camel.management.mbean.ManagedClaimCheck.getDefinition(ManagedClaimCheck.java:40)$
^Iat
org.apache.camel.management.mbean.ManagedClaimCheck.getDefinition(ManagedClaimCheck.java:29)$
^Iat
org.apache.camel.management.ManagedManagementStrategy.getManagedObjectName(ManagedManagementStrategy.java:122)$
^Iat
org.apache.camel.management.ManagedManagementStrategy.getObjectName(ManagedManagementStrategy.java:198)$
^Iat
org.apache.camel.management.ManagedManagementStrategy.isManaged(ManagedManagementStrategy.java:174)$
^Iat
org.apache.camel.management.DefaultManagementLifecycleStrategy.onServiceAdd(DefaultManagementLifecycleStrategy.java:437)$
^Iat
org.apache.camel.impl.RouteService.startChildService(RouteService.java:368)$
^Iat org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:196)$
^Iat org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)$
^Iat
org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3947)$
^Iat
org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3854)$
^Iat
org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3640)$
^Iat
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3492)$
^Iat
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)$
^Iat
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3251)$
^Iat
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3247)$
^Iat
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3270)$
^Iat
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3247)$
^Iat
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)$
^Iat
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3163)$
^Iat
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)$
^Iat
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174)$
^Iat
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)$
^Iat
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)$
^Iat
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)$
^Iat
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)$
^Iat
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)$
^Iat
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)$
^Iat
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)$
^Iat
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)$
^Iat
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)$
^Iat
org.springframework.boot.SpringApplication.run(SpringApplication.java:303)$
^Iat
org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)$
^Iat
org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)$
^Iat
esac.archive.soar.ingestlite.IngestApplication.main(IngestApplication.java:23)$
2019-05-29 15:38:57,698 3899 [main] WARN  
o.a.c.m.DefaultManagementLifecycleStrategy - Could not register service:
ClaimCheck[GetAndRemove] as Service MBean.$


I had a look in ManagedClaimCheck and it always casts the definition to
an ExpressionNode

Thanks for your help.
Jonathan

Reply | Threaded
Open this post in threaded view
|

Re: Using dynamic expression as claimCheck key

jpcook01
I got rid of the ManagedClaimCheck exception by upgrading my version of
camel from 2.21.0 to 2.24.0.

Just some help with dynamic key now please?

Thanks

On 2019-05-29 15:59, erars+jonathan.cook wrote:

> Hi,
>
> I'm trying to use the claimCheck but pass a dynamic key which would be
> something unique like the filename in my input message or the
> breadcrumbId. But it seems this processor doesn't support this?
>
> e.g)
> .claimCheck(ClaimCheckOperation.Set, "${headers.CamelFileName}",
> "body")
>
> Is there a way to use the simple method e.g)
> simple("${headers.CamelFileName}") but evaluate the expression at run
> time?
>
> Later I see another issue unrelated with this claimcheck definition, I
> always see this error which is unrelated to my route definition:
> 2019-05-29 15:38:57,698 3899 [main] WARN
> o.a.c.m.ManagedManagementStrategy - Cannot check whether the managed
> object is registered. This exception will be ignored.$
> java.lang.ClassCastException:
> org.apache.camel.model.ClaimCheckDefinition cannot be cast to
> org.apache.camel.model.ExpressionNode$
> ^Iat
> org.apache.camel.management.mbean.ManagedClaimCheck.getDefinition(ManagedClaimCheck.java:40)$
> ^Iat
> org.apache.camel.management.mbean.ManagedClaimCheck.getDefinition(ManagedClaimCheck.java:29)$
> ^Iat
> org.apache.camel.management.ManagedManagementStrategy.getManagedObjectName(ManagedManagementStrategy.java:122)$
> ^Iat
> org.apache.camel.management.ManagedManagementStrategy.getObjectName(ManagedManagementStrategy.java:198)$
> ^Iat
> org.apache.camel.management.ManagedManagementStrategy.isManaged(ManagedManagementStrategy.java:174)$
> ^Iat
> org.apache.camel.management.DefaultManagementLifecycleStrategy.onServiceAdd(DefaultManagementLifecycleStrategy.java:437)$
> ^Iat
> org.apache.camel.impl.RouteService.startChildService(RouteService.java:368)$
> ^Iat
> org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:196)$
> ^Iat org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3947)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3854)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3640)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3492)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3251)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3247)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3270)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3247)$
> ^Iat
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)$
> ^Iat
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3163)$
> ^Iat
> org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)$
> ^Iat
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174)$
> ^Iat
> org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)$
> ^Iat
> org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)$
> ^Iat
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)$
> ^Iat
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)$
> ^Iat
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)$
> ^Iat
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)$
> ^Iat
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)$
> ^Iat
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)$
> ^Iat
> org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)$
> ^Iat
> org.springframework.boot.SpringApplication.run(SpringApplication.java:303)$
> ^Iat
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)$
> ^Iat
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)$
> ^Iat
> esac.archive.soar.ingestlite.IngestApplication.main(IngestApplication.java:23)$
> 2019-05-29 15:38:57,698 3899 [main] WARN
> o.a.c.m.DefaultManagementLifecycleStrategy - Could not register
> service: ClaimCheck[GetAndRemove] as Service MBean.$
>
>
> I had a look in ManagedClaimCheck and it always casts the definition
> to an ExpressionNode
>
> Thanks for your help.
> Jonathan