Re: Cannot get filter() to work with mandatoryBodyAs
Christian - this was a user error on my part and I forgot that I could/should just overwrite and replace the in body of the exchange, in which case, I didn't need to filter out the no-longer-needed upstream message body. Thanks, Chris On Tue, Jun 11, 2013 at 11:19 AM, Christian Müller christian.muel...@gmail.com wrote: Can you try .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile)}))? Best, Christian Müller - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Tue, Jun 11, 2013 at 4:12 PM, Chris Wolf cwolf.a...@gmail.com wrote: I want to impose a filter such that only messages whose body is of type RemoteFile get through, So per the documentation: http://camel.apache.org/message-filter.html http://camel.apache.org/predicate.html http://camel.apache.org/simple.html I have: .filter(simple(${mandatoryBodyAs(RemoteFile.class)})) But I get: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1332) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:781) at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36) at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:32) at org.apache.camel.util.ExpressionToPredicateAdapter.matches(ExpressionToPredicateAdapter.java:32) at org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:75) at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:47) [] Caused by: java.lang.ClassNotFoundException: RemoteFile.class at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:779) ... 67 more ...even though I imported RemoteFile. So then I tried: .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile.class)})) and I get the same ClassNotFoundException, but with the full classname. How can I filter messages, such that only messages whose in-body is non-null and of a certain type get through? Thanks, Chris
Cannot get filter() to work with mandatoryBodyAs
I want to impose a filter such that only messages whose body is of type RemoteFile get through, So per the documentation: http://camel.apache.org/message-filter.html http://camel.apache.org/predicate.html http://camel.apache.org/simple.html I have: .filter(simple(${mandatoryBodyAs(RemoteFile.class)})) But I get: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1332) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:781) at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36) at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:32) at org.apache.camel.util.ExpressionToPredicateAdapter.matches(ExpressionToPredicateAdapter.java:32) at org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:75) at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:47) [] Caused by: java.lang.ClassNotFoundException: RemoteFile.class at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:779) ... 67 more ...even though I imported RemoteFile. So then I tried: .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile.class)})) and I get the same ClassNotFoundException, but with the full classname. How can I filter messages, such that only messages whose in-body is non-null and of a certain type get through? Thanks, Chris
Re: Cannot get filter() to work with mandatoryBodyAs ***DISREGARD***
In the simple language, a type is a string, not a class, so instead of .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile.class)})) ...I needed: .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile)})) (removed .class) On Tue, Jun 11, 2013 at 10:12 AM, Chris Wolf cwolf.a...@gmail.com wrote: I want to impose a filter such that only messages whose body is of type RemoteFile get through, So per the documentation: http://camel.apache.org/message-filter.html http://camel.apache.org/predicate.html http://camel.apache.org/simple.html I have: .filter(simple(${mandatoryBodyAs(RemoteFile.class)})) But I get: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1332) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:781) at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36) at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:32) at org.apache.camel.util.ExpressionToPredicateAdapter.matches(ExpressionToPredicateAdapter.java:32) at org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:75) at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:47) [] Caused by: java.lang.ClassNotFoundException: RemoteFile.class at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:779) ... 67 more ...even though I imported RemoteFile. So then I tried: .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile.class)})) and I get the same ClassNotFoundException, but with the full classname. How can I filter messages, such that only messages whose in-body is non-null and of a certain type get through? Thanks, Chris
Re: Cannot get filter() to work with mandatoryBodyAs
Can you try .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile)}))? Best, Christian Müller - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Tue, Jun 11, 2013 at 4:12 PM, Chris Wolf cwolf.a...@gmail.com wrote: I want to impose a filter such that only messages whose body is of type RemoteFile get through, So per the documentation: http://camel.apache.org/message-filter.html http://camel.apache.org/predicate.html http://camel.apache.org/simple.html I have: .filter(simple(${mandatoryBodyAs(RemoteFile.class)})) But I get: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1332) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:781) at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36) at org.apache.camel.support.ExpressionSupport.matches(ExpressionSupport.java:32) at org.apache.camel.util.ExpressionToPredicateAdapter.matches(ExpressionToPredicateAdapter.java:32) at org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:75) at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:47) [] Caused by: java.lang.ClassNotFoundException: RemoteFile.class at org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52) at org.apache.camel.builder.ExpressionBuilder$33.evaluate(ExpressionBuilder.java:779) ... 67 more ...even though I imported RemoteFile. So then I tried: .filter(simple(${mandatoryBodyAs(org.apache.camel.component.file.remote.RemoteFile.class)})) and I get the same ClassNotFoundException, but with the full classname. How can I filter messages, such that only messages whose in-body is non-null and of a certain type get through? Thanks, Chris