Context and RouteID as properties in From configuration

2018-02-20 Thread Leber, Thomas
Hi,

we want to create from tags in XML with information from the RouteID and the 
Context name. I tried it in this way



I know I can get the route ID in a simple statement in the route inflight but 
this does not work since this is evaluated during runtime and the from is a 
startup configuration.
Is there any build-in way to do this, or do I need to implement a custom 
resolver?

Best,
Thomas



AW: Camel JMS transferExchange=true Exception

2018-01-15 Thread Leber, Thomas
Hi Claus,

Ok thanks for this. I'll try to append whatever I found to the documentation.

One thing,  since some time I encounter some rendering problems of snippets on 
the camel homepage.
Is this a known problem?

Best,
Thomas


-Ursprüngliche Nachricht-
Von: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Gesendet: Montag, 15. Jänner 2018 10:56
An: users@camel.apache.org
Betreff: Re: Camel JMS transferExchange=true Exception

Hi

Its an Apache ActiveMQ setting (not Camel specific) that do not allow java 
serialized objects by default, and you need to configure it with the approved 
classes/packages.

If you want to help improve the docs at Apache Camel, then you can submit a PR 
with doc updates on this file 
https://github.com/apache/camel/blob/master/components/camel-jms/src/main/docs/jms-component.adoc

And how to contribute to Camel is here
http://camel.apache.org/contributing

On Mon, Jan 15, 2018 at 10:34 AM, Leber, Thomas <thomas.le...@omnetric.com> 
wrote:
> Hi,
>
> I'm sending in an onException clause the exchange to another camel route via 
> JMS.
> In order to handle the error, the idea was to use transferExchange=true, 
> since the documentations states the exchange exception is transferred as well.
>
> Unfortunately I get this error in the JMS listener:
> --
> --
> Execution of JMS message listener failed. Caused by: 
> [org.apache.camel.RuntimeCamelException - Failed to extract body due to: 
> javax.jms.JMSException: Failed to build body from content. Serializable class 
> not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden 
> class org.apache.camel.impl.DefaultExchangeHolder! This class is not trusted 
> to be serialized as ObjectMessage payload. Please take a look at 
> http://activemq.apache.org/objectmessage.html for more information on how to 
> configure trusted classes..
> --
> --
>
> I found out that there is a way to configure the security settings on the 
> AMQ, but I was surprised that this is not mentioned somewhere.
> Did anybody else encounter this problem?
>
> Camel 2.17.0
> AMQ 5.11.0
>
> Regards,
> Thomas Leber



--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Camel JMS transferExchange=true Exception

2018-01-15 Thread Leber, Thomas
Hi,

I'm sending in an onException clause the exchange to another camel route via 
JMS.
In order to handle the error, the idea was to use transferExchange=true, since 
the documentations states the exchange exception is transferred as well.

Unfortunately I get this error in the JMS listener:

Execution of JMS message listener failed. Caused by: 
[org.apache.camel.RuntimeCamelException - Failed to extract body due to: 
javax.jms.JMSException: Failed to build body from content. Serializable class 
not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden 
class org.apache.camel.impl.DefaultExchangeHolder! This class is not trusted to 
be serialized as ObjectMessage payload. Please take a look at 
http://activemq.apache.org/objectmessage.html for more information on how to 
configure trusted classes..


I found out that there is a way to configure the security settings on the AMQ, 
but I was surprised that this is not mentioned somewhere.
Did anybody else encounter this problem?

Camel 2.17.0
AMQ 5.11.0

Regards,
Thomas Leber


AW: File2 component: infinitely loop

2017-06-26 Thread Leber, Thomas
Hi,

This sound like the normal desired behavior of camel. 
Camel cannot move/process the file correctly and makes a complete rollback.
If you want to changes this behavior, then you need to add exception handling: 
http://camel.apache.org/error-handling-in-camel.html

-Ursprüngliche Nachricht-
Von: pelojoy [mailto:pelo...@gmail.com] 
Gesendet: Mittwoch, 21. Juni 2017 20:19
An: users@camel.apache.org
Betreff: File2 component: infinitely loop

I am using File2 component to process some file in a directory. But if it fails 
to move file to 'in-process' directory for whatever reason(maybe no 
permission), the file will be stuck in the directory and will be processed over 
and over again. Setting idempotent=true doesn't have any effect. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/File2-component-infinitely-loop-tp5805011.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Access Karaf ENV variable from Camel Spring context

2017-06-26 Thread Leber, Thomas
Hi all,

I have deployed a Spring Camel context on a stock Karaf container.
I have set a env variable like this:

JBossFuse:admin@devTL> env test
null
JBossFuse:admin@devTL> env test hi_all
JBossFuse:admin@devTL> env test
hi_all
JBossFuse:admin@devTL>

Now I want to access this variable via:

String test = exchange.getContext().resolvePropertyPlaceholders("{{env:test}}");

Unfortunatley this always returns 
java.lang.IllegalArgumentException: Property with key [env:test] using function 
[env] returned null value which is not allowed, from input: {{env:test}}

also I tried {{karaf.test}}
String test = 
exchange.getContext().resolvePropertyPlaceholders("{{karaf.test}}");

But I get

java.lang.IllegalArgumentException: PropertiesComponent with name properties 
must be defined in CamelContext to support property placeholders. Property with 
key [karaf.test] not found in properties from text: {{karaf.test}}

Meanwhile
String test = 
exchange.getContext().resolvePropertyPlaceholders("{{karaf:test}}");
Returns simply "test"


Any suggestions or is this simply not possible?

Best
Thomas Leber
thomas.le...@omnetric.com



AW: camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

2017-06-08 Thread Leber, Thomas
Ah sorry read this too late. Next time :)

-Ursprüngliche Nachricht-
Von: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Gesendet: Dienstag, 06. Juni 2017 20:23
An: users@camel.apache.org
Betreff: Re: camel-test-blueprint includes camel-test, breaks 
java.nio.file.Files.probeContentType(source);

Hi

I found a little time and have committed a fix for this on the branches.

On Tue, Jun 6, 2017 at 12:25 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> Ah that test-jar should only be used as part of testing 
> camel-test-blueprint itself. It should have scope=test like it does in 
> camel-spring etc.
>
> You are welcome to contribute a fix via a github PR
>
> On Tue, Jun 6, 2017 at 11:52 AM, Leber, Thomas 
> <thomas.le...@omnetric.com> wrote:
>> Hi all,
>>
>> We are using blueprint and therefore we include camel-test-blueprint. This 
>> also includes Camel-core dependencies with type "test-jar":
>>
>> https://github.com/apache/camel/blob/master/components/camel-test-blu
>> eprint/pom.xml
>>
>> 
>> org.apache.camel
>> camel-core
>> test-jar>  
>>
>> Problem is now that this contains a java service for " 
>> java.nio.file.spi.FileTypeDetector": 
>> https://github.com/apache/camel/blob/camel-2.17.x/camel-core/src/test
>> /resources/META-INF/services/java.nio.file.spi.FileTypeDetector
>>
>> This one is specifying the class " 
>> org.apache.camel.component.file.MyFileTypeDetector": 
>> https://github.com/apache/camel/blob/master/camel-core/src/test/java/
>> org/apache/camel/component/file/MyFileTypeDetector.java
>>
>> We are using in our code NIO to probe file contents. In our jUnit test cases 
>> Java is detecting the service and is therefore only loading " 
>> MyFileTypeDetector".
>> This always returns "txt" for a file type.
>>
>> We could fix this with adding an exclusion to our pom:
>>
>> 
>> org.apache.camel
>> camel-test-blueprint
>> 
>> 
>> org.apache.camel
>> camel-core
>> test-jar
>> 
>> 
>> 
>>
>> This is maybe something that should be fixed or at least mentioned in the 
>> camel documentation for blueprint camel test.
>>
>> Thomas Leber
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

2017-06-06 Thread Leber, Thomas
Hi all,

We are using blueprint and therefore we include camel-test-blueprint. This also 
includes Camel-core dependencies with type "test-jar":

https://github.com/apache/camel/blob/master/components/camel-test-blueprint/pom.xml


org.apache.camel
camel-core
test-jar

Problem is now that this contains a java service for " 
java.nio.file.spi.FileTypeDetector": 
https://github.com/apache/camel/blob/camel-2.17.x/camel-core/src/test/resources/META-INF/services/java.nio.file.spi.FileTypeDetector

This one is specifying the class " 
org.apache.camel.component.file.MyFileTypeDetector": 
https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/component/file/MyFileTypeDetector.java

We are using in our code NIO to probe file contents. In our jUnit test cases 
Java is detecting the service and is therefore only loading " 
MyFileTypeDetector". 
This always returns "txt" for a file type.

We could fix this with adding an exclusion to our pom:


org.apache.camel
camel-test-blueprint


org.apache.camel
camel-core
test-jar




This is maybe something that should be fixed or at least mentioned in the camel 
documentation for blueprint camel test.

Thomas Leber


Routing Slip + InOutPattern + Transaction does not work

2017-03-02 Thread Leber, Thomas
Hi,

I'm trying to use a Routing Slip with the InOut pattern. Also I have the 
requirement to transact the whole system. I have set up a small example but I 
won't run.
The message stays inside the "producer" queue and will not be Picked up by the 
"_route1" or "_route2".

When I'm commenting the line "" from 
the ActiveMq Component, it works fine, but then nothing is transacted.

Also the line:  does not reset the JMSReply to header, so every other following queue will 
try to send a reply to this temp queue.

Any ideas how to solve 
a. that I can user Transaction, InOut Pattern and a routing slip.
b. that the JMSReply header is reset. I know I can use removeHeaders, but it 
looks a bit as a bug for me...

Best,
Thomas


http://www.osgi.org/xmlns/blueprint/v1.0.0; 
xmlns:amq="http://activemq.org/config/1.0; 
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint 
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd;>

































http://camel.apache.org/schema/blueprint;>











asdf


ExcutionProcessA


ExcutionProcessB




activemq:queue:${header.queue1},activemq:queue:${header.queue2}


${body} - main route















${body} - route 1



yeah!






${body} - route 1



yeah!






${body} - route 2


yeah!






RE: Apache Camel disable DTD validation or resolve to relativ Path

2017-02-21 Thread Leber, Thomas
Hi,

I tried this also but the resolver gets not invoked when resolving the dtd, 
with the xsd it works fine.



Mit TouchDown von meinem Android-Telefon gesendet (www.symantec.com)

-Original Message-
From: Claus Ibsen [claus.ib...@gmail.com]
Received: Dienstag, 21 Feb. 2017, 19:08
To: users@camel.apache.org [users@camel.apache.org]
Subject: Re: Apache Camel disable DTD validation or resolve to relativ Path

You can maybe plugin a custom resource resolver and let it return null
/empty or something.

Check the docs
https://github.com/apache/camel/blob/master/camel-core/src/main/docs/validator-component.adoc

And you can find some unit tests that test this resolver

On Tue, Feb 21, 2017 at 6:55 PM, Leber, Thomas
<thomas.le...@omnetric.com> wrote:
> Hi,
>
> I'm using the camel validator component to validate an XML. The XML has a DTD 
> declaration inside. This points to a relative path, where I don't want to 
> have the DTD.
>
> 
>
> Is there any way to disable the DTD validation or resolve the declared DTD to 
> a path where I want to have the DTD?
>
> I tried until now to use the VM property:
>
> -Djavax.xml.stream.supportDTD=false
>
> but I had no luck with that.
>
> While stepping trough the code I also noticed that, between different starts 
> of camel, it uses once the StAX implementation and another time the SAX. Any 
> glue why? I'm using all the time the same file and not changing the code.
>
> This question is x-posted on 
> http://stackoverflow.com/questions/42374455/apache-camel-disable-dtd-validation-or-resolve-to-relativ-path
>
> Best Regards,
> Thomas Leber



--
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Apache Camel disable DTD validation or resolve to relativ Path

2017-02-21 Thread Leber, Thomas
Hi,

I'm using the camel validator component to validate an XML. The XML has a DTD 
declaration inside. This points to a relative path, where I don't want to have 
the DTD.



Is there any way to disable the DTD validation or resolve the declared DTD to a 
path where I want to have the DTD?

I tried until now to use the VM property:

-Djavax.xml.stream.supportDTD=false

but I had no luck with that.

While stepping trough the code I also noticed that, between different starts of 
camel, it uses once the StAX implementation and another time the SAX. Any glue 
why? I'm using all the time the same file and not changing the code.

This question is x-posted on 
http://stackoverflow.com/questions/42374455/apache-camel-disable-dtd-validation-or-resolve-to-relativ-path

Best Regards,
Thomas Leber