Re: What's the Difference between handled(false) and continued(true) (and more...)?

2011-04-14 Thread Claus Ibsen
handle(true) = the exception is handled and removed from the exchange
+ break out routing
handled(false) = the exception is not handled, so it will be stored as
an exception on the exchange + break out routing
continue(true) = handled(true) + continue routing



On Thu, Apr 14, 2011 at 8:48 AM, hyjshanghai hyjshang...@gmail.com wrote:
 With regard to the onException Spring DSL, here are my questions based the
 following 5 definitions (Example A-E).
 Note that I replaced lt; and gt; with ( and )

 1. What's the difference between handled(false) and continued(true)?
 (Example C v.s. D)
 According to my experience, only continued(true) will really continue
 routing as if the exception has not happend.
 handled(false) will break out routing, just like what handled(true) does. Is
 this normal?

 2. Similar to question 1, what's the difference between handled(true) and
 continued(false)? (Example B v.s. E)
 Should continued(false) also break out the normal routing on exception, just
 like what handled(true) does?

 3. A famous book on Camel says OnException doesn’t handle exceptions by
 default.
 However, Example A also breaks out normal routing on Exception, just like
 what Example B does by my experience.
 Is my experience conflicting with the Book's assertion that exception is not
 handled by default?

 Example A:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)
            (camel:process ref=arithmeticExceptionProcessor /)
       (/camel:onException)

 Example B:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)

 (camel:handled)(camel:constant)true(/camel:constant)(/camel:handled)
            (camel:process ref=arithmeticExceptionProcessor /)
       (/camel:onException)

 Example C:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)

 (camel:handled)(camel:constant)false(/camel:constant)(/camel:handled)
            (camel:process ref=arithmeticExceptionProcessor /)
       (/camel:onException)

 Example D:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)

 (camel:continued)(camel:constant)true(/camel:constant)(/camel:continued)
            (camel:process ref=arithmeticExceptionProcessor /)
       (/camel:onException)

 Example E:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)

 (camel:continued)(camel:constant)false(/camel:constant)(/camel:continued)
            (camel:process ref=arithmeticExceptionProcessor /)
       (/camel:onException)


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/What-s-the-Difference-between-handled-false-and-continued-true-and-more-tp4302302p4302302.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Custom Exchange ID

2011-04-14 Thread Willem Jiang

Hi Claus,

I dug the code of DefaultExchange and found below lines in DefaultExchange

protected String createExchangeId() {
String answer = null;
if (in != null) {
answer = in.createExchangeId();
}
if (answer == null) {
answer = context.getUuidGenerator().generateUuid();
}
return answer;
}

From the code you can see the ExchangeId is decided by the in message 
first, and in the JMSMessage there is no way to inject the ExchangeId by 
the pluggable API. That is way I create a JIRA for it.



Willem

On 4/14/11 1:19 PM, Claus Ibsen wrote:

On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiangwillem.ji...@gmail.com  wrote:

Yes, it's hard to change unless you extends the JMS component and override
this method.

I just created a JIRA CAMEL-3859[1] for it.

[1]https://issues.apache.org/jira/browse/CAMEL-3859



No thats not necessary. There are 2 id's
- exchange
- message id

And he want to assign custom exchange id. Which is easier to do in
Camel 2.5 as there is a pluggable API for that.

The message id is part of the message, and since that message is JMS,
the message id is the JMSMessageID.






Willem

On 4/13/11 11:46 PM, kumaap wrote:


Hi thanks for that .. but theres another issue we consuming messages off
multiple JMS  providers

Camel 2.5 JmsMessage class

@Override
 protected String createMessageId() {
 if (jmsMessage == null) {
 if (LOG.isTraceEnabled()) {
 LOG.trace(No javax.jms.Message set so generating a new
message id);
 }
 return super.createMessageId();
 }
 try {
 String id =
getDestinationAsString(jmsMessage.getJMSDestination()) +
jmsMessage.getJMSMessageID();
 return getSanitizedString(id);
 } catch (JMSException e) {
 throw new RuntimeExchangeException(Unable to retrieve
JMSMessageID from JMS Message, getExchange(), e);
 }
 }

It will always use the JMS qualifiers , its hardly ever the case that JMS
messages have a null JMSMessageID. Is there a way to override this ?

Cheers in advance
kumaap0

--
View this message in context:
http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com








--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com


Re: Custom Exchange ID

2011-04-14 Thread Claus Ibsen
Willem its 2 different ids

Although the camel-jms component indeed favors using the JMSMessageID
(if possible) in the createExchangeId method it overrides in the
JmsMessage.

But its still 2 different ids
- exchange id
- message id

But that said, I don't think we should add bluntly more features and
bells just because a single person want to use his custom ids in an
old Camel release (Camel 2.4). That person has the source code and can
adjust the code however he likes.

Frankly we may even consider removing the JmsMessage override, and
always let it use the id generated by default exchange. Then its
consistent.

I will try to ping James if he sees a good point of the reason of the
current behavior.


On Thu, Apr 14, 2011 at 9:27 AM, Willem Jiang willem.ji...@gmail.com wrote:
 Hi Claus,

 I dug the code of DefaultExchange and found below lines in DefaultExchange

    protected String createExchangeId() {
        String answer = null;
        if (in != null) {
            answer = in.createExchangeId();
        }
        if (answer == null) {
            answer = context.getUuidGenerator().generateUuid();
        }
        return answer;
    }

 From the code you can see the ExchangeId is decided by the in message first,
 and in the JMSMessage there is no way to inject the ExchangeId by the
 pluggable API. That is way I create a JIRA for it.


 Willem

 On 4/14/11 1:19 PM, Claus Ibsen wrote:

 On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiangwillem.ji...@gmail.com
  wrote:

 Yes, it's hard to change unless you extends the JMS component and
 override
 this method.

 I just created a JIRA CAMEL-3859[1] for it.

 [1]https://issues.apache.org/jira/browse/CAMEL-3859


 No thats not necessary. There are 2 id's
 - exchange
 - message id

 And he want to assign custom exchange id. Which is easier to do in
 Camel 2.5 as there is a pluggable API for that.

 The message id is part of the message, and since that message is JMS,
 the message id is the JMSMessageID.





 Willem

 On 4/13/11 11:46 PM, kumaap wrote:

 Hi thanks for that .. but theres another issue we consuming messages off
 multiple JMS  providers

 Camel 2.5 JmsMessage class

 @Override
     protected String createMessageId() {
         if (jmsMessage == null) {
             if (LOG.isTraceEnabled()) {
                 LOG.trace(No javax.jms.Message set so generating a new
 message id);
             }
             return super.createMessageId();
         }
         try {
             String id =
 getDestinationAsString(jmsMessage.getJMSDestination()) +
 jmsMessage.getJMSMessageID();
             return getSanitizedString(id);
         } catch (JMSException e) {
             throw new RuntimeExchangeException(Unable to retrieve
 JMSMessageID from JMS Message, getExchange(), e);
         }
     }

 It will always use the JMS qualifiers , its hardly ever the case that
 JMS
 messages have a null JMSMessageID. Is there a way to override this ?

 Cheers in advance
 kumaap0

 --
 View this message in context:

 http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



 --
 Willem
 --
 FuseSource
 Web: http://www.fusesource.com
 Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
 Twitter: willemjiang

 Connect at CamelOne May 24-26
 The Open Source Integration Conference
 http://camelone.com






 --
 Willem
 --
 FuseSource
 Web: http://www.fusesource.com
 Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
 Twitter: willemjiang

 Connect at CamelOne May 24-26
 The Open Source Integration Conference
 http://camelone.com




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Custom Exchange ID

2011-04-14 Thread Claus Ibsen
Okay found this JIRA ticket who introduced the behavior in JmsMessage
https://issues.apache.org/jira/browse/CAMEL-1375


-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Custom Exchange ID

2011-04-14 Thread Willem Jiang

Hi Claus,

I know there are two different ID and I'm +1 for removing the JmsMessage 
id overriding. I will update the JIRA title for it.



Willem


On 4/14/11 3:45 PM, Claus Ibsen wrote:

Willem its 2 different ids

Although the camel-jms component indeed favors using the JMSMessageID
(if possible) in the createExchangeId method it overrides in the
JmsMessage.

But its still 2 different ids
- exchange id
- message id

But that said, I don't think we should add bluntly more features and
bells just because a single person want to use his custom ids in an
old Camel release (Camel 2.4). That person has the source code and can
adjust the code however he likes.

Frankly we may even consider removing the JmsMessage override, and
always let it use the id generated by default exchange. Then its
consistent.

I will try to ping James if he sees a good point of the reason of the
current behavior.


On Thu, Apr 14, 2011 at 9:27 AM, Willem Jiangwillem.ji...@gmail.com  wrote:

Hi Claus,

I dug the code of DefaultExchange and found below lines in DefaultExchange

protected String createExchangeId() {
String answer = null;
if (in != null) {
answer = in.createExchangeId();
}
if (answer == null) {
answer = context.getUuidGenerator().generateUuid();
}
return answer;
}

 From the code you can see the ExchangeId is decided by the in message first,
and in the JMSMessage there is no way to inject the ExchangeId by the
pluggable API. That is way I create a JIRA for it.


Willem

On 4/14/11 1:19 PM, Claus Ibsen wrote:


On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiangwillem.ji...@gmail.com
  wrote:


Yes, it's hard to change unless you extends the JMS component and
override
this method.

I just created a JIRA CAMEL-3859[1] for it.

[1]https://issues.apache.org/jira/browse/CAMEL-3859



No thats not necessary. There are 2 id's
- exchange
- message id

And he want to assign custom exchange id. Which is easier to do in
Camel 2.5 as there is a pluggable API for that.

The message id is part of the message, and since that message is JMS,
the message id is the JMSMessageID.






Willem

On 4/13/11 11:46 PM, kumaap wrote:


Hi thanks for that .. but theres another issue we consuming messages off
multiple JMS  providers

Camel 2.5 JmsMessage class

@Override
 protected String createMessageId() {
 if (jmsMessage == null) {
 if (LOG.isTraceEnabled()) {
 LOG.trace(No javax.jms.Message set so generating a new
message id);
 }
 return super.createMessageId();
 }
 try {
 String id =
getDestinationAsString(jmsMessage.getJMSDestination()) +
jmsMessage.getJMSMessageID();
 return getSanitizedString(id);
 } catch (JMSException e) {
 throw new RuntimeExchangeException(Unable to retrieve
JMSMessageID from JMS Message, getExchange(), e);
 }
 }

It will always use the JMS qualifiers , its hardly ever the case that
JMS
messages have a null JMSMessageID. Is there a way to override this ?

Cheers in advance
kumaap0

--
View this message in context:

http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com








--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com








--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com


Re: Custom Exchange ID

2011-04-14 Thread Claus Ibsen
On Thu, Apr 14, 2011 at 10:04 AM, Willem Jiang willem.ji...@gmail.com wrote:
 Hi Claus,

 I know there are two different ID and I'm +1 for removing the JmsMessage id
 overriding. I will update the JIRA title for it.


Okay talked to James. He can't remember the good reason for that. So
we are +1 for your change.
Then the exchange id is always generated by default exchange and thus
it uses the pluggable api, so end user can use a custom generate if
they want.



 Willem


 On 4/14/11 3:45 PM, Claus Ibsen wrote:

 Willem its 2 different ids

 Although the camel-jms component indeed favors using the JMSMessageID
 (if possible) in the createExchangeId method it overrides in the
 JmsMessage.

 But its still 2 different ids
 - exchange id
 - message id

 But that said, I don't think we should add bluntly more features and
 bells just because a single person want to use his custom ids in an
 old Camel release (Camel 2.4). That person has the source code and can
 adjust the code however he likes.

 Frankly we may even consider removing the JmsMessage override, and
 always let it use the id generated by default exchange. Then its
 consistent.

 I will try to ping James if he sees a good point of the reason of the
 current behavior.


 On Thu, Apr 14, 2011 at 9:27 AM, Willem Jiangwillem.ji...@gmail.com
  wrote:

 Hi Claus,

 I dug the code of DefaultExchange and found below lines in
 DefaultExchange

    protected String createExchangeId() {
        String answer = null;
        if (in != null) {
            answer = in.createExchangeId();
        }
        if (answer == null) {
            answer = context.getUuidGenerator().generateUuid();
        }
        return answer;
    }

  From the code you can see the ExchangeId is decided by the in message
 first,
 and in the JMSMessage there is no way to inject the ExchangeId by the
 pluggable API. That is way I create a JIRA for it.


 Willem

 On 4/14/11 1:19 PM, Claus Ibsen wrote:

 On Thu, Apr 14, 2011 at 5:18 AM, Willem Jiangwillem.ji...@gmail.com
  wrote:

 Yes, it's hard to change unless you extends the JMS component and
 override
 this method.

 I just created a JIRA CAMEL-3859[1] for it.

 [1]https://issues.apache.org/jira/browse/CAMEL-3859


 No thats not necessary. There are 2 id's
 - exchange
 - message id

 And he want to assign custom exchange id. Which is easier to do in
 Camel 2.5 as there is a pluggable API for that.

 The message id is part of the message, and since that message is JMS,
 the message id is the JMSMessageID.





 Willem

 On 4/13/11 11:46 PM, kumaap wrote:

 Hi thanks for that .. but theres another issue we consuming messages
 off
 multiple JMS  providers

 Camel 2.5 JmsMessage class

 @Override
     protected String createMessageId() {
         if (jmsMessage == null) {
             if (LOG.isTraceEnabled()) {
                 LOG.trace(No javax.jms.Message set so generating a
 new
 message id);
             }
             return super.createMessageId();
         }
         try {
             String id =
 getDestinationAsString(jmsMessage.getJMSDestination()) +
 jmsMessage.getJMSMessageID();
             return getSanitizedString(id);
         } catch (JMSException e) {
             throw new RuntimeExchangeException(Unable to retrieve
 JMSMessageID from JMS Message, getExchange(), e);
         }
     }

 It will always use the JMS qualifiers , its hardly ever the case that
 JMS
 messages have a null JMSMessageID. Is there a way to override this ?

 Cheers in advance
 kumaap0

 --
 View this message in context:


 http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300938.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



 --
 Willem
 --
 FuseSource
 Web: http://www.fusesource.com
 Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
 Twitter: willemjiang

 Connect at CamelOne May 24-26
 The Open Source Integration Conference
 http://camelone.com






 --
 Willem
 --
 FuseSource
 Web: http://www.fusesource.com
 Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
 Twitter: willemjiang

 Connect at CamelOne May 24-26
 The Open Source Integration Conference
 http://camelone.com






 --
 Willem
 --
 FuseSource
 Web: http://www.fusesource.com
 Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
 Twitter: willemjiang

 Connect at CamelOne May 24-26
 The Open Source Integration Conference
 http://camelone.com




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Custom Exchange ID

2011-04-14 Thread Claus Ibsen
On Wed, Apr 13, 2011 at 4:23 PM, kumaap amitesh.a.ku...@gmail.com wrote:
 Hi ,

 I'm using camel 2.4 and we have a need to create unique ids for every
 message going through our routes, We were looking at using the Exchange ID
 but its in a different format than our requirement is it possible to
 override the Exchange id generation class. Our routes are xml format and are
 dynamically loaded.


To re-iterate you only option with Camel 2.4 is to change the source
code. See DefaultExchange and JmsMessage where you need to alter the
code so it can use your custom exchange id generator.

In JmsMessage just remove the createExchangeId method so it defaults
to the behavior from DefaultExchange. Then you use your custom id
generate in DefaultExchange.



 Cheers
 Amitesh

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4300720.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Custom Exchange ID

2011-04-14 Thread kumaap
Thanks guys,

we have a interim fix and will be updating to 2.6 anyway but 
https://issues.apache.org/jira/browse/CAMEL-3859 [CAMEL-3859]  will give us
a better solution.

Thanks 
kumaap0

--
View this message in context: 
http://camel.465427.n5.nabble.com/Custom-Exchange-ID-tp4300720p4302527.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Log4j Appender

2011-04-14 Thread Gert Villemos
Did this issue moved forward? 

I can find a log4j JMS logger that can inject data into an ActiveMQ, but I
would like to inject events into a camel route which might go to ActiveMQ,
but might also have other steps.

Can this be done?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302784.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to correctly setup Tomcat 7 to enable sending messages between 2 wars

2011-04-14 Thread peter.argalas
Dear,

I have two applications deployed to tomcat as two separate wars. Application
1 wants to send message to application 2 using VM component. Documentation
says, that camel-core.jar has to be on the system/boot classpath.

I have stored camel-core-2.7.0.jar in $CATALINA_HOME/lib restarted tomcat,
deployed both applications, but message cannot be sent to application 2 (it
times out). 

1. Has to be camel-core-2.7.0.jar excluded from WAR?
2. Does anybody have example of Tomcat 7 setup that shares camel-core.jar
for all applications?

Thanks.


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-correctly-setup-Tomcat-7-to-enable-sending-messages-between-2-wars-tp4302787p4302787.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Log4j Appender

2011-04-14 Thread Claus Ibsen
On Thu, Apr 14, 2011 at 1:27 PM, Gert Villemos gville...@yahoo.de wrote:
 Did this issue moved forward?

 I can find a log4j JMS logger that can inject data into an ActiveMQ, but I
 would like to inject events into a camel route which might go to ActiveMQ,
 but might also have other steps.

 Can this be done?

Yeah I think log4j has a plugin API for appenders.
You should check log4j documentation.

And as you know we love contributions so if you go about developing
such an appender, then consider donating it to Apache.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302784.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Camel Log4j Appender

2011-04-14 Thread Gert Villemos
Creating a custom log4j appender is very easy (... indeed we have one but we
are not happy with it as it only injects into ActiveMQ and not into a Camel
route).

Our only problem (and this is now turning into a developer question more
than a user question) is how can the custom Appender which is a part of the
log4j hierarchy get a reference to a route producer template?

If we for example 

1. Configure an instance of the custom appender and using the
log4j.properties / log4j.xml file configure it to inject into the route
direct:logs.

2. Configure a Camel route 'from(direct:logs).to(activemq:topic:logs)'

How do we in the log4j Appender get a reference to the ProducerTemplate with
the identifier 'direct:logs'?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302852.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Log4j Appender

2011-04-14 Thread Claus Ibsen
Yeah this can be tricky as you would have different classloaders and whatnot.
Also the log4j could be shared among different Camel applications.

You can use a remote transport of some sort, and send data over HTTP.

However if you run in Karaf, then pax-logging, may have some osgi
related stuff you can leverage.


On Thu, Apr 14, 2011 at 2:17 PM, Gert Villemos gville...@yahoo.de wrote:
 Creating a custom log4j appender is very easy (... indeed we have one but we
 are not happy with it as it only injects into ActiveMQ and not into a Camel
 route).

 Our only problem (and this is now turning into a developer question more
 than a user question) is how can the custom Appender which is a part of the
 log4j hierarchy get a reference to a route producer template?

 If we for example

 1. Configure an instance of the custom appender and using the
 log4j.properties / log4j.xml file configure it to inject into the route
 direct:logs.

 2. Configure a Camel route 'from(direct:logs).to(activemq:topic:logs)'

 How do we in the log4j Appender get a reference to the ProducerTemplate with
 the identifier 'direct:logs'?

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302852.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Camel Mail with attachment problem

2011-04-14 Thread Laurentiu Trica
Hello,

I have a problem using Camel Mail. I can get emails with attachments without
any problem.
But when I send an email with attachment, the attachment gets truncated and
I see only the last 3KB of it.
I have to add that I construct my attachment from converting the route
content(String) into attachment, if this makes any difference, but I tested
the conversion and nothing disappears in there because using Servicemix
Mail does the trick...

Has anyone any idea about this?

-- 
Laurentiu Trica
Software Developer Mobile: (+40) 722 329318
S.C MoreDevs S.R.L.  Email: laurentiu.tr...@finalfolder.biz

This message can contain privileged or confidential information and it is
intended only for addressee. Any unauthorized disclosure is strictly
prohibited.


Re: Camel Log4j Appender

2011-04-14 Thread Guillaume Nodet
In case you deploy camel in karaf, camel already defines a custom
pax-logging appender which intercepts all log events (slf4j, log4j,
jul, jcl) and can process them.
See http://camel.apache.org/pax-logging.html

On Thu, Apr 14, 2011 at 14:49, Claus Ibsen claus.ib...@gmail.com wrote:
 Yeah this can be tricky as you would have different classloaders and whatnot.
 Also the log4j could be shared among different Camel applications.

 You can use a remote transport of some sort, and send data over HTTP.

 However if you run in Karaf, then pax-logging, may have some osgi
 related stuff you can leverage.


 On Thu, Apr 14, 2011 at 2:17 PM, Gert Villemos gville...@yahoo.de wrote:
 Creating a custom log4j appender is very easy (... indeed we have one but we
 are not happy with it as it only injects into ActiveMQ and not into a Camel
 route).

 Our only problem (and this is now turning into a developer question more
 than a user question) is how can the custom Appender which is a part of the
 log4j hierarchy get a reference to a route producer template?

 If we for example

 1. Configure an instance of the custom appender and using the
 log4j.properties / log4j.xml file configure it to inject into the route
 direct:logs.

 2. Configure a Camel route 'from(direct:logs).to(activemq:topic:logs)'

 How do we in the log4j Appender get a reference to the ProducerTemplate with
 the identifier 'direct:logs'?

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Using-Camel-Log4j-on-Multiple-Machines-tp466678p4302852.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




 --
 Claus Ibsen
 -
 FuseSource
 Email: cib...@fusesource.com
 Web: http://fusesource.com
 CamelOne 2011: http://fusesource.com/camelone2011/
 Twitter: davsclaus
 Blog: http://davsclaus.blogspot.com/
 Author of Camel in Action: http://www.manning.com/ibsen/




-- 
Cheers,
Guillaume Nodet

Blog: http://gnodet.blogspot.com/

Open Source SOA
http://fusesource.com

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com/


Re: missing region property in aws-sns component

2011-04-14 Thread Marco Crivellaro
You have to create an AmazonSNSClient and specify the endpoint otherwise it
will default to us-east-1 


AWSCredentials awsCredentials = new BasicAWSCredentials(***, !!!);
AmazonSNSClient client = new AmazonSNSClient(awsCredentials);
client.setEndpoint(http://sns.eu-west-1.amazonaws.com/;);  
((JndiRegistry) ((PropertyPlaceholderDelegateRegistry)
context.getRegistry()).getRegistry()).bind(amazonSNSClient, client);



than you can use the sns client created in the uri:

template.sendBodyAndHeader(aws-sns://MyTopic?amazonSNSClient=#amazonSNSClient,
{\test\:\testvalue\}, Test, Test header);

--
View this message in context: 
http://camel.465427.n5.nabble.com/missing-region-property-in-aws-sns-component-tp4303687p4303872.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: missing region property in aws-sns component

2011-04-14 Thread Richard Kettelerij
This is a useful explanation. I've added it to the Camel website:
https://cwiki.apache.org/confluence/display/CAMEL/AWS-SNS

On Thu, Apr 14, 2011 at 9:47 PM, Marco Crivellaro mcr...@optasportsdata.com
 wrote:

 You have to create an AmazonSNSClient and specify the endpoint otherwise it
 will default to us-east-1


 AWSCredentials awsCredentials = new BasicAWSCredentials(***, !!!);
 AmazonSNSClient client = new AmazonSNSClient(awsCredentials);
 client.setEndpoint(http://sns.eu-west-1.amazonaws.com/;);
 ((JndiRegistry) ((PropertyPlaceholderDelegateRegistry)
 context.getRegistry()).getRegistry()).bind(amazonSNSClient, client);



 than you can use the sns client created in the uri:


 template.sendBodyAndHeader(aws-sns://MyTopic?amazonSNSClient=#amazonSNSClient,
 {\test\:\testvalue\}, Test, Test header);

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/missing-region-property-in-aws-sns-component-tp4303687p4303872.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: missing region property in aws-sns component

2011-04-14 Thread preben
It might be more concise if you could set the awssnsendpoint as an uri option
like the rest of the properties.

eg. add
private String awsSNSEndpoint to SnsConfiguration;

and in SnsEndpoint.createSNSClient do
   
if (configuration.getAwsSNSEndpoint() != null) {
client.setEndpoint(configuration.getAwsSNSEndpoint());
   }
 
This way you would be able to use the full Spring xml using the uri +
options eg:
aws-sns://b2btopic?awsSNSEndpoint=sns.eu-west-1.amazonaws.comamp;accessKey=amp;secretKey=

I have tried it out and it works nice.

/preben



--
View this message in context: 
http://camel.465427.n5.nabble.com/missing-region-property-in-aws-sns-component-tp4303687p4303974.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Migration from Camel 1.6 to 2.7

2011-04-14 Thread vineet
So we decided to migrate to Spring 3.0 and saw that we necessarily needed to
upgrade camel as well, since
org.springframework.jms.listener.serversession.ServerSessionFactory does not
exist in spring 3.0.

We have different projects and they talk over JMS. I was planning to upgrade
only one project for now.

So the issue I am having is when a message gets passed from a Project still
on 1.6 to my project on 2.7 I get the following error (please see below).

Any ideas? To me it seems 1.6 serialized messages cannot be understood by
2.7 so both my projects need to be on 2.7. 
But that seems wrong to me. 

I am very new to camel.. so pardon me in case of me not knowing something
obvious!

Thanks...
Vineet



org.apache.camel.component.jms.JmsMessageListenerContainer - Execution of
JMS message listener failed, and no ErrorHandler has been set.
org.apache.camel.RuntimeCamelException: Failed to extract body due to:
javax.jms.JMSException: Failed to build body from bytes. Reason:
java.io.InvalidClassException:
org.apache.camel.component.bean.BeanInvocation; local class incompatible:
stream classdesc serialVersionUID = -9178727976940773498, local class
serialVersionUID = -7835266201358427212. Message: ActiveMQObjectMessage
{blah blah blah}
at
org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:160)
at
org.apache.camel.component.jms.JmsMessage.createBody(JmsMessage.java:183)
at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:41)
at org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:72)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:94)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:92)
... spring related stack trace  
Caused by: javax.jms.JMSException: Failed to build body from bytes. Reason:
java.io.InvalidClassException:
org.apache.camel.component.bean.BeanInvocation; local class incompatible:
stream classdesc serialVersionUID = -9178727976940773498, local class
serialVersionUID = -7835266201358427212
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
at
org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183)
at
org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:127)
... 22 more
Caused by: java.io.InvalidClassException:
org.apache.camel.component.bean.BeanInvocation; local class incompatible:
stream classdesc serialVersionUID = -9178727976940773498, local class
serialVersionUID = -7835266201358427212
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
at 
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at
org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:177)
... 23 more


--
View this message in context: 
http://camel.465427.n5.nabble.com/Migration-from-Camel-1-6-to-2-7-tp4304191p4304191.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Migration from Camel 1.6 to 2.7

2011-04-14 Thread Claus Ibsen
It seems like you got some messages on a JMS message queue which has
send message to that queue using one version of Camel. And then you
have another version of Camel consuming those messages. And then you
have a version mis-match.

You should use compatible versions of Camel on both sides. The problem
is that you use javax.jmx.ObjectMessage (eg Java objects) as JMS
messages. And thus they need to be serializable compatible.




On Thu, Apr 14, 2011 at 11:40 PM, vineet vineet.pand...@gmail.com wrote:
 So we decided to migrate to Spring 3.0 and saw that we necessarily needed to
 upgrade camel as well, since
 org.springframework.jms.listener.serversession.ServerSessionFactory does not
 exist in spring 3.0.

 We have different projects and they talk over JMS. I was planning to upgrade
 only one project for now.

 So the issue I am having is when a message gets passed from a Project still
 on 1.6 to my project on 2.7 I get the following error (please see below).

 Any ideas? To me it seems 1.6 serialized messages cannot be understood by
 2.7 so both my projects need to be on 2.7.
 But that seems wrong to me.

 I am very new to camel.. so pardon me in case of me not knowing something
 obvious!

 Thanks...
 Vineet


 
 org.apache.camel.component.jms.JmsMessageListenerContainer - Execution of
 JMS message listener failed, and no ErrorHandler has been set.
 org.apache.camel.RuntimeCamelException: Failed to extract body due to:
 javax.jms.JMSException: Failed to build body from bytes. Reason:
 java.io.InvalidClassException:
 org.apache.camel.component.bean.BeanInvocation; local class incompatible:
 stream classdesc serialVersionUID = -9178727976940773498, local class
 serialVersionUID = -7835266201358427212. Message: ActiveMQObjectMessage
 {blah blah blah}
        at
 org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:160)
        at
 org.apache.camel.component.jms.JmsMessage.createBody(JmsMessage.java:183)
        at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:41)
        at org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:72)
        at
 org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:94)
        at
 org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
        at
 org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at
 org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at
 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at
 org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
        at
 org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
        at
 org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:92)
        ... spring related stack trace
 Caused by: javax.jms.JMSException: Failed to build body from bytes. Reason:
 java.io.InvalidClassException:
 org.apache.camel.component.bean.BeanInvocation; local class incompatible:
 stream classdesc serialVersionUID = -9178727976940773498, local class
 serialVersionUID = -7835266201358427212
        at
 org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
        at
 org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183)
        at
 org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:127)
        ... 22 more
 Caused by: java.io.InvalidClassException:
 org.apache.camel.component.bean.BeanInvocation; local class incompatible:
 stream classdesc serialVersionUID = -9178727976940773498, local class
 serialVersionUID = -7835266201358427212
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
        at 
 java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
        at
 java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at
 org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:177)
        ... 23 more


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Migration-from-Camel-1-6-to-2-7-tp4304191p4304191.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: 

Re: Migration from Camel 1.6 to 2.7

2011-04-14 Thread vineet
Thanks Claus for the quick response.


--
View this message in context: 
http://camel.465427.n5.nabble.com/Migration-from-Camel-1-6-to-2-7-tp4304191p4304252.html
Sent from the Camel - Users mailing list archive at Nabble.com.


SFTP camelExclusiveReadLock race condition

2011-04-14 Thread Patrick Daly
Camel 2.7, Windows 2003

Continuing on from this issue

http://camel.465427.n5.nabble.com/SFTP-rename-problems-td478681.html#a478683

We recently moved to version 2.7.

And are polling files from a sftp server.

We have two client that are writing files to folder which we are scanning.
One uploads file using a temp name followed by a rename. Everything works
fine.

Second client uploads file to folder without a temp name, we appear to get a
race condition on the file
and in turn have incomplete files transfers to our 2nd route. Even after
setting readLock=rename

The only files that appear to pass through without problems from the second
client is the smaller files.

During testing, I can drop files PDF's onto the sftp server, and quickly
open a file.
SFTP consumer will wait until it gets a lock before processing.

However this lock does not appear to work whenever we have a slow producer.

We hope to get our client to change their process.

Thanks


Re: Camel Mail with attachment problem

2011-04-14 Thread Willem Jiang

Hi,

How do you setup the attachment?
I don't think converting the message body into attachment will lost the 
date.



On 4/14/11 10:08 PM, Laurentiu Trica wrote:

Hello,

I have a problem using Camel Mail. I can get emails with attachments without
any problem.
But when I send an email with attachment, the attachment gets truncated and
I see only the last 3KB of it.
I have to add that I construct my attachment from converting the route
content(String) into attachment, if this makes any difference, but I tested
the conversion and nothing disappears in there because using Servicemix
Mail does the trick...

Has anyone any idea about this?




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com


Re: How to correctly setup Tomcat 7 to enable sending messages between 2 wars

2011-04-14 Thread Willem Jiang

On 4/14/11 7:30 PM, peter.argalas wrote:

Dear,

I have two applications deployed to tomcat as two separate wars. Application
1 wants to send message to application 2 using VM component. Documentation
says, that camel-core.jar has to be on the system/boot classpath.

I have stored camel-core-2.7.0.jar in $CATALINA_HOME/lib restarted tomcat,
deployed both applications, but message cannot be sent to application 2 (it
times out).

1. Has to be camel-core-2.7.0.jar excluded from WAR?


Yes, you need to remove the camel-core from your application WAR.


2. Does anybody have example of Tomcat 7 setup that shares camel-core.jar
for all applications?

Thanks.


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-correctly-setup-Tomcat-7-to-enable-sending-messages-between-2-wars-tp4302787p4302787.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com


Re: How to correctly setup Tomcat 7 to enable sending messages between 2 wars

2011-04-14 Thread peter.argalas
Willem Thanks for advise.

Currently my applications are working together. Steps that had to be done
for camel 2.7.0 and tomcat 7.0.6 are:

1. place camel-core, log4j, slf4j-api, slf4j-log4j12 and commons-management
into $CATALINA_HOME/lib
2. remove mentioned jars from both war files

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-correctly-setup-Tomcat-7-to-enable-sending-messages-between-2-wars-tp4302787p4304773.html
Sent from the Camel - Users mailing list archive at Nabble.com.