Way to find out if a message has reached all the destinationtions?

2011-12-05 Thread Narita Bagchi
Is there a way to find out if a message, after multicasting, has reached all 
destinations or not?

~ Narita


***The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged material. 
Any review,retransmission,dissemination or other use of, or taking of any 
action in reliance upon, this information by persons or entities other than the 
intended recipient is prohibited. If you received this in error, please contact 
the sender and delete the material from any computer.***


Re: Velocity without java

2011-12-05 Thread Claus Ibsen
Hi

You can use xpath to grab the values you want to use in the velocity
template, and set them as headers.

setHeader headerName=fooxpath/foo/text()/xpath/setHeader

Then you can access the ${header.foo} from the velocity template.

Mind that when you use xpath and the XML has namespaces, then the
xpath expression must use those namespaces as well.
It can be a bit tricky to get the xpath expression working.

See examples here:
http://camel.apache.org/xpath


On Fri, Dec 2, 2011 at 7:46 PM, MichaelAtSAG mebevilac...@gmail.com wrote:
 The Apache Camel example for Velocity using Java code to implement the logic.
 Is there an example available that does not use java?

 We are trying to use a Spring XML approach and cannot figure out how to
 connect the message properties into the velocity template.

 -Velocity template:-

 Dear Purchaser,

 We have an ${headers.eventtype} situation. We need
 ${body.DesiredInventoryLevel} piece(s) for part number ${body.ItemID}.

 Please review this situation.



 -Message:-
 ?xml version=1.0 encoding=UTF-8?
 evt:Event xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
        xmlns:evt=http://namespaces.xyz.com/EDA/Event;
        
 xmlns:pay=http://namespaces.xyz.com/EDA/WebM/Sample/InventoryMgmt/1.0;
    evt:Body
        pay:PartInventoryShortage
            pay:Part
                pay:ItemIDABC123/pay:ItemID
                pay:ItemNameWidget for thingy/pay:ItemName
                pay:ModelACME /pay:Model
                pay:ColorGrey/pay:Color
                pay:ShapeOval/pay:Shape
            /pay:Part
            pay:InventoryLevel5/pay:InventoryLevel
            pay:DesiredInventoryLevel45/pay:DesiredInventoryLevel
            pay:SupplierInventoryLevel28/pay:SupplierInventoryLevel
        /pay:PartInventoryShortage
    /evt:Body
 /evt:Event

 -Content file -

 ?xml version=1.0 encoding=UTF-8 standalone=no?
 beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
        xsi:schemaLocation=        http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://camel.apache.org/schema/spring
 http://camel.apache.org/schema/spring/camel-spring.xsd;

        camelContext xmlns=http://camel.apache.org/schema/spring; id=camel
                xmlns:evt=http://namespaces.xyz.com/EDA/Event;

                route id=Announcer startupOrder=3
                        from uri=file:src/data?noop=true /
                        setHeader headerName=eventtype
                                xpath/evt:Event/evt:Header/evt:Type/xpath
                        /setHeader
                        choice
                                when
                                        language language=xpath$eventtype =

 '{http://namespaces.xyz.com/EDA/WebM/Sample/InventoryMgmt/1.0}PartInventoryShortage'
                                        /language
                                        log message=Announce 
 PartInventoryShortage(b): file - gt;
 jms:InvMgmt /
                                        to 
 uri=velocity:file:src/main/resources/email.vm /
                                        log message=Announce 
 PartInventoryShortage(a): file - gt; email /

                                        to uri=outputToScreen /
                                /when
                        /choice
                /route
        /camelContext
 /beans


 How do I connect the message properties with the velocity template? Do I
 need to set header properties in the Camel context file? I did this for
 routing logic, yet the header element shows like this:

 We have an *com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList@4e39f16f*
 situation.


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Velocity-without-java-tp5042886p5042886.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: Riding on org.apache.camel.language.TokenPairPredicateTest

2011-12-05 Thread Claus Ibsen
Yeah could be OS specific. Do you use Windows?


On Fri, Dec 2, 2011 at 3:52 PM, bvahdat babak.vah...@swissonline.ch wrote:
 BTW, on the CI-Servers the test passed by the last build [1], so that maybe
 it could be an OS issue as well.

 [1]
 https://builds.apache.org/job/Camel.trunk.fulltest/org.apache.camel$camel-core/576/testReport/org.apache.camel.language/TokenPairPredicateTest/

 Babak

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Riding-on-org-apache-camel-language-TokenPairPredicateTest-tp5041981p5042086.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: Camel message -How long custom headers and properties live

2011-12-05 Thread Claus Ibsen
Hi

When you send messages with Camel, then only details from the
org.apache.camel.Message is being send over the protocols.
So for JMS that means, the Camel message body + headers.

The properties on the Exchange is *not* part of the message, and will
not be send. The properties is stored for the lifetime of the
Exchange, where Camel end users can use the properties to store and
get access to the data they stored at any time.

For JMS there is restrictions what you can send as headers, according
to the JMS spec. Take a read on the Camel JMS wiki page.

If the value type of a header is not valid according to the JMS spec,
then Camel will drop the header.
Generally simple types such as: boolean, int, String etc. works.



On Mon, Dec 5, 2011 at 1:25 AM, rspeter rspe...@yahoo.com wrote:
 Good day everyone,

 I am using apache-activemq-5.5.1-fuse-00-08 and camel-core-2.8.0-fuse-00-08
 and have read about few topics on how to solve the issue with custom headers
 and properties.
 But I am unable to solve this issue. Any help is appreciated.

 Earlier topic on this issue:
 http://camel.465427.n5.nabble.com/How-long-do-the-camel-headers-live-in-routes-td474477.html
 http://camel.465427.n5.nabble.com/Pass-properties-headers-to-another-endpoint-td477128.html

 All headers and properties are visible before the queue but they disappear
 once it reaches the JMS queue.
 The properties are worse than headers. I tried to log it after consuming
 from the queue and could see one or two headers.

 Sample test:
 
                route inheritErrorHandler=true
                    descriptiontest1/description
                        from uri=direct:test/
                        log message=before queue: properties/
                        log message=x1:${property.x1}/
                        log message=x2:${property.x2}/
                        log message=x3:${property.x3}/
                        log message=x4:${property.x4}/
                        doTry

                                log message=swap properties to headers/
                                setHeader 
 headerName=a1simple${property.x1}/simple/setHeader
                                setHeader 
 headerName=b1simple${property.x2}/simple/setHeader
                                setHeader 
 headerName=c1simple${property.x3}/simple/setHeader
                                setHeader 
 headerName=d1simple${property.x4}/simple/setHeader
 setHeader headerName=xyzconstantheader as constant always
 works/constant/setHeader
                                inOnly uri=activemq:myqueue1 
 inheritErrorHandler=true/
                                doCatch
                                        
 exceptionjava.lang.Exception/exception
                                /doCatch
                        /doTry
                /route


                route inheritErrorHandler=true
                        descriptiontest2/description
                   from uri=activemq:myqueue1/
                        log message=after queue: properties/
                        log message=x1:${property.x1}/
                        log message=x2:${property.x2}/
                        log message=x3:${property.x3}/
                        log message=x4:${property.x4}/

                        log message=after queue: headers/
                        log message=a1:${in.header.a1}/
                        log message=b1:${in.header.b1}/
                        log message=c1:${in.header.c1}/
                        log message=d1:${in.header.d1}/
 log message=xyz:${in.header.xyz}/


                        inOnly uri=activemq:myqueue2 
 inheritErrorHandler=true/
        /route

 The log results:
 --
  INFO | before queue: properties
  INFO | x1:test
  INFO | x2:
  INFO | x3:ff
  INFO | x4:hello
  INFO | swap properties to headers
  INFO | after queue: properties
  INFO | x1:
  INFO | x2:
  INFO | x3:
  INFO | x4:
  INFO | after queue: headers
  INFO | a1:
  INFO | b1:
  INFO | c1:ff
  INFO | d1:hello
 INFO | xyz:header as constant always works

 All properties are not visible, but some headers are visible except a1.
 Claus, Roman were suggesting to use property instead of headers, but I
 couldn't get it working.
 Could you please suggest?

 Regards
 Peter


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-message-How-long-custom-headers-and-properties-live-tp5047495p5047495.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: Riding on org.apache.camel.language.TokenPairPredicateTest

2011-12-05 Thread bvahdat
 Yeah could be OS specific. Do you use Windows? 

the issue is indeed OS specific which is Windows, just saw the retries logic
in org.apache.camel.util.FileUtil.renameFile() as well as a lot of hits on
Google...

But as I've already mentioned in this thread that's not my concern at all
but the way exchange routing behaves by the file component, as if there were
no problem. It seems to me as if there is an onException claus on the route
like:

onException(java.lang.Exception.class).handled(true).continued(true);

Which is not!

Any thoughts?

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Riding-on-org-apache-camel-language-TokenPairPredicateTest-tp5041981p5048255.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with detour

2011-12-05 Thread Claus Ibsen
On Thu, Dec 1, 2011 at 9:47 PM, pvenini pven...@mervaros.com.ar wrote:
 Hi, I'm using a detour so that if a message has a suscription flag it then
 connects to a database and creates an entry (in addition to the normal
 processing of the message).

 from(quickfix:marketdata.cfg).
 filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.MARKET_DATA_REQUEST)).
 unmarshal(camelDataFormat).
 choice().
  when().method(marketDataSuscription, isSubscription).process(new
 SuscriptionProcessor()).to(jdbc:marketDataSuscription).end().
 process(new FixMarketDataRequestProcessor()).
 to(jetty:{{http.marketdataunicast}}).
 split().method(marketDataSplitter, split).
 process(new MarketDataSplitterProcessor());

 However it gives a compile time error at the last process call with the
 following error:
 The method process(MarketDataSplitterProcessor) is undefined for the type
 Object


Hi

You should be able to use a parameter for the split instead, then the
.process should be working

 split(method(marketDataSplitter, split)).
 process(new MarketDataSplitterProcessor());


 I tried replacing the end() with an endChoice(); it compiles but then it
 gives a run time error:

 Exception in thread main java.lang.ClassCastException:
 org.apache.camel.model.FilterDefinition cannot be cast to
 org.apache.camel.model.ChoiceDefinition
        at
 org.apache.camel.model.ProcessorDefinition.endChoice(ProcessorDefinition.java:1124)
        at
 ar.com.mervaros.gateway.MyRouteBuilder.configure(MyRouteBuilder.java:125)
        at
 org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
        at
 org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
        at
 org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
        at
 org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:613)
        at ar.com.mervaros.gateway.Gateway.main(Gateway.java:33)


 Any tip would be apreciated.

 Thanks

 Pablo

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Problem-with-detour-tp5039887p5039887.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: Riding on org.apache.camel.language.TokenPairPredicateTest

2011-12-05 Thread Claus Ibsen
I created a ticket
https://issues.apache.org/jira/browse/CAMEL-4742

And have a fix for this in testing.



On Mon, Dec 5, 2011 at 10:01 AM, bvahdat babak.vah...@swissonline.ch wrote:
 Yeah could be OS specific. Do you use Windows?

 the issue is indeed OS specific which is Windows, just saw the retries logic
 in org.apache.camel.util.FileUtil.renameFile() as well as a lot of hits on
 Google...

 But as I've already mentioned in this thread that's not my concern at all
 but the way exchange routing behaves by the file component, as if there were
 no problem. It seems to me as if there is an onException claus on the route
 like:

 onException(java.lang.Exception.class).handled(true).continued(true);

 Which is not!

 Any thoughts?

 Babak

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Riding-on-org-apache-camel-language-TokenPairPredicateTest-tp5041981p5048255.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: It does not support starting Camel as a standalone application?

2011-12-05 Thread Willem Jiang

Did you need camel-scala component ?
If not, you can just remove camel-scala from your class path.

On Mon Dec  5 14:38:33 2011, 玉峰 wrote:

To start Camel as a standalone application, Why is there the following error?
It does not support starting Camel as a standalone application?

Exception in thread main org.apache.camel.RuntimeCamelException: 
org.apache.camel.TypeConverterLoaderException: Failed to load type converters because of: 
Cannot find any type converter classes from the following packages: 
[org.apache.camel.scala.converter.ScalaTypeConverter]
  at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1164)
  at 
org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:988)
  at 
org.apache.camel.impl.DefaultCamelContext.getTypeConverterRegistry(DefaultCamelContext.java:1003)
  at 
org.apache.camel.impl.DefaultCamelContext.forceLazyInitialization(DefaultCamelContext.java:1963)
  at 
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1437)
  at 
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1349)
  at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
  at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
  at 
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1317)
  at org.apache.camel.Main.doStart(Main.java:61)
  at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
  at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
  at org.apache.camel.impl.MainSupport.run(MainSupport.java:136)
  at MainExample.boot(MainExample.java:28)
  at MainExample.main(MainExample.java:15)
Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load type 
converters because of: Cannot find any type converter classes from the 
following packages: [org.apache.camel.scala.converter.ScalaTypeConverter]
  at 
org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:116)
  at 
org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:406)
  at 
org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:42)
  at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
  at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
  at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:56)
  at 
org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1635)
  at 
org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:903)
  at 
org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:986)
  ... 13 more

//-Java code--
public class MainExample {
 private Main main;
 public static void main(String[] args) throws Exception {
 MainExample example = new MainExample();
 example.boot();
 }
 public void boot() throws Exception {
 // create a Main instance
 main = new Main();
 // enable hangup support so you can press ctrl + c to terminate the JVM
 main.enableHangupSupport();
 // add routes
 main.addRouteBuilder(new MyRouteBuilder());
 // run until you terminate the JVM
 System.out.println(Starting Camel. Use ctrl + c to terminate the 
JVM.\n);
 main.run();
 }
 private static class MyRouteBuilder extends RouteBuilder {
 @Override
 public void configure() throws Exception {
 from(timer:foo?delay=2000)
 .process(new Processor() {
 public void process(Exchange exchange) throws Exception {
 System.out.println(Invoked timer at  + new Date());
 }
 });
 }
 }
}






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


Re: Odd info logs about startup w/ autoStartup=false

2011-12-05 Thread Claus Ibsen
Hi

I created a ticket to track this
https://issues.apache.org/jira/browse/CAMEL-4744

On Thu, Dec 1, 2011 at 10:33 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 Yeah the wording could be improved. Any recommendation?


 On Thu, Dec 1, 2011 at 12:28 AM, Jason Dillon ja...@planet57.com wrote:
 Any reason why these are at INFO level in DefaultCamelContext?

 snip
 if (doNotStartRoutesOnFirstStart) {
    log.info(Cannot start routes as CamelContext has been configured with 
 autoStartup=false);
 }
 /snip

 snip
 if (addingRoute  !autoStartup) {
    log.info(Cannot start route  + routeService.getId() +  as its 
 configured with autoStartup=false);
    continue;
 }
 /snip

 The language sounds like something strange/bad happened, but configuring 
 autoStartup=false isn't strange or bad.  I don't get why this detail is 
 logged at INFO.

 Its not really a big deal, I was just surprised to see it in my logs after I 
 added a route w/ this set so that I could thread the start of the route in 
 the background.

 --jason



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



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


Re: Way to find out if a message has reached all the destinationtions?

2011-12-05 Thread Raul Kripalani
Yes, you can configure an AggregationStrategy to process replies as they
come in and determine whether the entire multicast has succeeded or not.
Check out the strategyRef property on [1].

[1] http://camel.apache.org/multicast.html.

Regards,
Raúl.

On 5 December 2011 08:38, Narita Bagchi narita.bag...@headstrong.comwrote:

 Is there a way to find out if a message, after multicasting, has reached
 all destinations or not?

 ~ Narita

 
 ***The information transmitted is intended only for the person or entity
 to which it is addressed and may contain confidential and/or privileged
 material. Any review,retransmission,dissemination or other use of, or
 taking of any action in reliance upon, this information by persons or
 entities other than the intended recipient is prohibited. If you received
 this in error, please contact the sender and delete the material from any
 computer.***



Re: Way to find out if a message has reached all the destinationtions?

2011-12-05 Thread Hadrian Zbarcea
When a Producer fails to send the message to the destination and 
exception will be raised. That's the easiest thing to look for.


Hadrian

On 12/05/2011 09:00 AM, Raul Kripalani wrote:

Yes, you can configure an AggregationStrategy to process replies as they
come in and determine whether the entire multicast has succeeded or not.
Check out the strategyRef property on [1].

[1] http://camel.apache.org/multicast.html.

Regards,
Raúl.

On 5 December 2011 08:38, Narita Bagchinarita.bag...@headstrong.comwrote:


Is there a way to find out if a message, after multicasting, has reached
all destinations or not?

~ Narita


***The information transmitted is intended only for the person or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review,retransmission,dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.***





--
Hadrian Zbarcea
Principal Software Architect
Talend, Inc
http://coders.talend.com/
http://camelbot.blogspot.com/


Re: Riding on org.apache.camel.language.TokenPairPredicateTest

2011-12-05 Thread bvahdat
Hi

The fix you provided indeed did mitigated the issue I had on Windows
(TokenPairPredicateTest now passes as well), however my viewpoint as I
shared in [1] is still pending. Effectively what I would expect to have in
LoggingExceptionHandler is the code below, which *per default* rethrows the
exception after it logs it. However making that change in my workspace (of
course) now causes side effects by other unit-tests to fail. So I assume to
fix LoggingExceptionHandler *to not just swallow* the thrown exceptions will
be not that trivial!

Just as an example imagine a simple billing-system having a single camel
context with two routes in it. One route produces the monthly bills and dump
them into a xml-file (using the file producer), the other one reads that
xml-file (through the file consumer), splits the bill-entries and send the
bills to the consumers by mail. Now with that exception swalling behaviour
of LoggingExceptionHandler in place, if generating/renaming/moving of the
xml-file by the first route fails in between, for example just because of
the possible:

- disk out of space issue
- maximum unix quota has been already reached issue 

Then the second route would wait  wait  wait forever and there will be not
even an invocation of possible onException clause (if any) at all. So the
operation guys will not realize any problem (not even through JMX or
whatnot)...So happy free-service for the customers...

How do you see this? Am I missing something?

[1]
http://camel.465427.n5.nabble.com/Riding-on-org-apache-camel-language-TokenPairPredicateTest-td5041981.html

Babak

public class LoggingExceptionHandler implements ExceptionHandler {
private final CamelLogger logger;
private final boolean rethrowException;

public LoggingExceptionHandler(Class? ownerType) {
this(new CamelLogger(LoggerFactory.getLogger(ownerType)), true);
}

public LoggingExceptionHandler(Class? ownerType, LoggingLevel level) {
this(new CamelLogger(LoggerFactory.getLogger(ownerType), level),
true);
}

public LoggingExceptionHandler(Class? ownerType, boolean
rethrowException) {
this(new CamelLogger(LoggerFactory.getLogger(ownerType),
LoggingLevel.ERROR), rethrowException);
}

public LoggingExceptionHandler(Class? ownerType, LoggingLevel level,
boolean rethrowException) {
this(new CamelLogger(LoggerFactory.getLogger(ownerType), level),
rethrowException);
}

public LoggingExceptionHandler(CamelLogger logger, boolean
rethrowException) {
this.logger = logger;
this.rethrowException = rethrowException;
}

public void handleException(Throwable exception) {
handleException(null, null, exception);
}

public void handleException(String message, Throwable exception) {
handleException(message, null, exception);
}

public void handleException(String message, Exchange exchange, Throwable
exception) {
try {
String msg =
CamelExchangeException.createExceptionMessage(message, exchange, exception);
if (isCausedByRollbackExchangeException(exception)) {
// do not log stacktrace for intended rollbacks
logger.log(msg);
} else {
logger.log(msg, exception);
}
} catch (Throwable e) {
// the logging exception handler must not cause new exceptions
to occur
}

// rethrow the exception (wrapped by RuntimeCamelException) if we're
asked to do so
if (rethrowException) {
throw ObjectHelper.wrapRuntimeCamelException(exception);
}
}

protected boolean isCausedByRollbackExchangeException(Throwable
exception) {
if (exception instanceof RollbackExchangeException) {
return true;
} else if (exception.getCause() != null) {
// recursive children
return
isCausedByRollbackExchangeException(exception.getCause());
}

return false;
}
}


--
View this message in context: 
http://camel.465427.n5.nabble.com/Riding-on-org-apache-camel-language-TokenPairPredicateTest-tp5041981p5049061.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Same thing?

2011-12-05 Thread MichaelAtSAG
Are these two Spring XML expressions functionality equivalent?

(1)
choice
when
xpath
$evtType = 'PartInventoryLow'
/xpath

(2)
choice
when
language language=xpath
$evtType = 'PartInventoryLow'
/language

Thanks!
Michael

--
View this message in context: 
http://camel.465427.n5.nabble.com/Same-thing-tp5049364p5049364.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Same thing?

2011-12-05 Thread Claus Ibsen
Hi

Yes the should be the same.


On Mon, Dec 5, 2011 at 5:22 PM, MichaelAtSAG mebevilac...@gmail.com wrote:
 Are these two Spring XML expressions functionality equivalent?

 (1)
 choice
        when
                xpath
                        $evtType = 'PartInventoryLow'
                /xpath

 (2)
 choice
        when
                language language=xpath
                        $evtType = 'PartInventoryLow'
                /language

 Thanks!
 Michael

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Same-thing-tp5049364p5049364.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: Same thing?

2011-12-05 Thread MichaelAtSAG
Excellent, thanks Claus.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Same-thing-tp5049364p5049406.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Loading two camel context files at start

2011-12-05 Thread MichaelAtSAG
How do I load two Camel Spring XML context files at start? 

Env:

Two Camel Spring XML files in:

src/main/resources/META-INF/spring/camel-context-1.xml
src/main/resources/META-INF/spring/camel-context-2.xml

When I start, only camel-context-1.xml is loading.

If I remove camel-context-1.xml, then camel-context-2.xml loads.

Eclipse output shows that only one file is selected:

2011-12-05 09:52:32,801 [main   ] INFO  XmlBeanDefinitionReader   
- Loading XML bean definitions from file
[D:\Users\michaelb\workspace\camel-example-spring-eda\target\classes\META-INF\spring\camel-context-2.xml]

--
View this message in context: 
http://camel.465427.n5.nabble.com/Loading-two-camel-context-files-at-start-tp5049449p5049449.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Loading two camel context files at start

2011-12-05 Thread MichaelAtSAG
I believe I have solved this by making the Camel-Context ID unique:

src/main/resources/META-INF/spring/camel-context-1.xml 
camelContext xmlns=http://camel.apache.org/schema/spring; id=camel1

src/main/resources/META-INF/spring/camel-context-2.xml 
camelContext xmlns=http://camel.apache.org/schema/spring; id=camel2

Is the recommended approach?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Loading-two-camel-context-files-at-start-tp5049449p5049497.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Loading two camel context files at start

2011-12-05 Thread bvahdat
Pasting your java code where you boot up your Spring-IOC-Container would make
it easier to answer your question. How do you run/deploy your Camel context?
Standalone, inside a JEE-Container or inside Karaf?

It seems to me as if something is wired there. But basically you don't have
to assign ids to your Camel Contexts, as Spring assigns ids to it's managed
POJOs (CamelContext is one of them) automatically if not already explicitly
specified [1].

Using ClassPathXmlApplicationContext [2] or FileSystemXmlApplicationContext
[3] you should be able to provide multiple Spring resources while booting-up
Spring, see also [4] for some examples.


[1]
http://static.springsource.org/spring/docs/3.0.6.RELEASE/spring-framework-reference/html/beans.html#beans-beanname
[2]
http://static.springsource.org/spring/docs/3.0.6.RELEASE/javadoc-api/org/springframework/context/support/ClassPathXmlApplicationContext.html
[3]
http://static.springsource.org/spring/docs/3.0.6.RELEASE/javadoc-api/org/springframework/context/support/FileSystemXmlApplicationContext.html
[4]
http://static.springsource.org/spring/docs/3.0.6.RELEASE/spring-framework-reference/html/resources.html#resources-app-ctx-construction
[4] http://camel.apache.org/spring-example.html

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Loading-two-camel-context-files-at-start-tp5049449p5049859.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Loading two camel context files at start

2011-12-05 Thread MichaelAtSAG
Thanks Babak, the launch code is below.

/**
 *license
 */

package com.xyz.eda;

import org.apache.camel.spring.Main;

/**
 * Launch NERV
 * 
 */
public class NERV  {
/**
 * 
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
new Main().run(args);
}

}


--
View this message in context: 
http://camel.465427.n5.nabble.com/Loading-two-camel-context-files-at-start-tp5049449p5049892.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Performance issue with Camel JMS publish/subscribe

2011-12-05 Thread RadoslavStoyanov
Hi,
I experience the next problem:
Created two Endpoints pointing to same JMS topic. The JMS provider is
WmBroker.
Used Spring xml descriptor to define the Camel context. The first endpoint
is used for publishing, the second for subscribing.
I instantiated two of our pub/sub API classes to test the performance - one
using directly our wmBroker api, and another one using Camel for pub/sub.

The test is:
There is registered one subscriber listener.
In another thread there are sent 1 messages. 
Ther start time is registered. 
When the last message is received the listener register the end time.
Then the sent messages are devided by the passed time and the result is the
passed through messages per second.

The disturbing thing is that the custom API using the same connection
factory shows 10:1 better performance in same conditions as Camel.
Do you have any ide why Camel shows so big performance drawback?
This is the used camel context, if it is neded I could provide also the test
java code used for the performance test.

beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=
   http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd;

camelContext id=camel xmlns=http://camel.apache.org/schema/spring;

jmxAgent id=agent createConnector=true /  
endpoint id=inboundSMS
uri=jms:topic:Event::WebM::Communication::Sms::SmsSent /
endpoint id=outboundSMS
uri=jms:topic:Event::WebM::Communication::Sms::SmsSent /

/camelContext

bean id=jms class=org.apache.camel.component.jms.JmsComponent
property name=connectionFactory
bean 
class=com.webmethods.jms.impl.WmConnectionFactoryImpl
property name=BrokerHost 
value=localhost:6849 /
property name=BrokerName value=Broker #1 /
property name=ClientGroup 
value=StressGroup /
/bean
/property
/bean

bean id=etStoreConfig

class=com.softwareag.eda.configuration.beans.FileEventTypeStoreConfigType
property name=location 
value=E:/SoftwareAG/common/EventTypeStore /
/bean

bean id=edaEventTypeStore
class=com.softwareag.eda.store.api.EventTypeStoreFactory
factory-method=createEventTypeStore 
depends-on=etStoreConfig
constructor-arg name=configuration ref=etStoreConfig
type=com.softwareag.eda.configuration.beans.EventTypeStoreConfigType/
/bean 

bean id=camelConnector
class=org.apache.camel.example.spring.CamelConnector
property name=context ref=camel /
/bean

bean id=eventTypeID 
class=com.softwareag.eda.store.api.EDAEventTypeID
constructor-arg name=namespace
value=http://namespaces.softwareag.com/EDA/WebM/Communication/Sms/
constructor-arg name=name value=SmsSent/
/bean

bean id=edaOrchestratorCamel
class=com.softwareag.eda.orchestrator.impl.EDAOrchestratorImpl
depends-on=camelConnector, edaEventTypeStore
constructor-arg name=connector ref=camelConnector
type=com.softwareag.eda.connector.EventBusConnector/
constructor-arg name=eventTypeStore ref=edaEventTypeStore
type=com.softwareag.eda.store.api.EDAEventTypeStore/
/bean

bean id=streamConfiguration class=java.io.FileInputStream 
constructor-arg value=C:/edaconfig/edaConfig.xml
type=java.lang.String/
/bean

bean id=edaOrchestratorCustom
class=com.softwareag.eda.orchestrator.api.EDAOrchestratorFactory
factory-method=createOrchestrator depends-on=streamConfiguration
constructor-arg ref=streamConfiguration 
type=java.io.InputStream/
/bean


bean id=testClient class=org.apache.camel.example.spring.TestClient
init-method=init depends-on=edaOrchestratorCamel,
edaOrchestratorCustom
property name=orchestratorCamel ref=edaOrchestratorCamel /
property name=orchestratorCustom ref=edaOrchestratorCustom 
/
property name=edaEventTypeID ref=eventTypeID /
/bean

/beans


--
View this message in context: 
http://camel.465427.n5.nabble.com/Performance-issue-with-Camel-JMS-publish-subscribe-tp5049909p5049909.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Loading two camel context files at start

2011-12-05 Thread bvahdat
As you see in [1] if you don't specify your spring configuration resource
explicity (through Main.setApplicationContextUri()), per default Camel sets
the *single* configuration to

private String applicationContextUri = META-INF/spring/*.xml;

So that Spring *hits* and *loads*
src/main/resources/META-INF/spring/camel-context-1.xml as the first
matching resource of that regular expression.

However the solution in your easy is pretty easy, as an example just create
an ApplicationContext like:

AbstractApplicationContext context = new
ClassPathXmlApplicationContext(classpath:META-INF/spring/camel-context-1.xml,
classpath:META-INF/spring/camel-context-2.xml);

and then wire it to [1] using:

Main.setApplicationContext(context);

Another possible approach would be if you would use spring import feature
[2], that's import  camel-context-2.xml into camel-context-1.xml, an then
just try to load camel-context-1.xml using Main.setApplicationContextUri().

That all said, just looking at [1] I think even using
Main.setApplicationContextUri(META-INF/spring/camel-context-1.xml;META-INF/spring/camel-context-2.xml)
should also do the trick.

Thanks God, there are bunch of ways in Camel one can reach his goals ;-)

Please also note that through Maven default-project-directory-layout the
directory src/main/resources is *already* on the classpath*, so that you
can omit that prefix while providing the URIs.

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
[2]
http://static.springsource.org/spring/docs/3.0.6.RELEASE/spring-framework-reference/html/beans.html#beans-factory-xml-import

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Loading-two-camel-context-files-at-start-tp5049449p5049995.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Performance issue with Camel JMS publish/subscribe

2011-12-05 Thread Sven Zethelius
I suspect you aren't caching the connection/sessions.  Try wrapping the 
connectionfactory with a 
org.springframework.jms.connection.SingleConnectionFactory or 
org.springframework.jms.connection.CachingConnectionFactory.  In your direct 
case, you have a persisted connections, and most likely a single session.  The 
default behavior of Spring-JMS, which is what Camel is using, is to let the 
connectionfactory worry about the caching by asking it each time for a fresh 
instance (e.g. through the SingleConnectionFactory or CachingConnectionFactory 
wrappers).

-Original Message-
From: RadoslavStoyanov [mailto:radoslav.stoya...@softwareag.com] 
Sent: Monday, December 05, 2011 11:45 AM
To: users@camel.apache.org
Subject: Performance issue with Camel JMS publish/subscribe

Hi,
I experience the next problem:
Created two Endpoints pointing to same JMS topic. The JMS provider is
WmBroker.
Used Spring xml descriptor to define the Camel context. The first endpoint
is used for publishing, the second for subscribing.
I instantiated two of our pub/sub API classes to test the performance - one
using directly our wmBroker api, and another one using Camel for pub/sub.

The test is:
There is registered one subscriber listener.
In another thread there are sent 1 messages. 
Ther start time is registered. 
When the last message is received the listener register the end time.
Then the sent messages are devided by the passed time and the result is the
passed through messages per second.

The disturbing thing is that the custom API using the same connection
factory shows 10:1 better performance in same conditions as Camel.
Do you have any ide why Camel shows so big performance drawback?
This is the used camel context, if it is neded I could provide also the test
java code used for the performance test.

beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=
   http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd;

camelContext id=camel xmlns=http://camel.apache.org/schema/spring;

jmxAgent id=agent createConnector=true /  
endpoint id=inboundSMS
uri=jms:topic:Event::WebM::Communication::Sms::SmsSent /
endpoint id=outboundSMS
uri=jms:topic:Event::WebM::Communication::Sms::SmsSent /

/camelContext

bean id=jms class=org.apache.camel.component.jms.JmsComponent
property name=connectionFactory
bean 
class=com.webmethods.jms.impl.WmConnectionFactoryImpl
property name=BrokerHost 
value=localhost:6849 /
property name=BrokerName value=Broker #1 /
property name=ClientGroup 
value=StressGroup /
/bean
/property
/bean

bean id=etStoreConfig

class=com.softwareag.eda.configuration.beans.FileEventTypeStoreConfigType
property name=location 
value=E:/SoftwareAG/common/EventTypeStore /
/bean

bean id=edaEventTypeStore
class=com.softwareag.eda.store.api.EventTypeStoreFactory
factory-method=createEventTypeStore 
depends-on=etStoreConfig
constructor-arg name=configuration ref=etStoreConfig
type=com.softwareag.eda.configuration.beans.EventTypeStoreConfigType/
/bean 

bean id=camelConnector
class=org.apache.camel.example.spring.CamelConnector
property name=context ref=camel /
/bean

bean id=eventTypeID 
class=com.softwareag.eda.store.api.EDAEventTypeID
constructor-arg name=namespace
value=http://namespaces.softwareag.com/EDA/WebM/Communication/Sms/
constructor-arg name=name value=SmsSent/
/bean

bean id=edaOrchestratorCamel
class=com.softwareag.eda.orchestrator.impl.EDAOrchestratorImpl
depends-on=camelConnector, edaEventTypeStore
constructor-arg name=connector ref=camelConnector
type=com.softwareag.eda.connector.EventBusConnector/
constructor-arg name=eventTypeStore ref=edaEventTypeStore
type=com.softwareag.eda.store.api.EDAEventTypeStore/
/bean

bean id=streamConfiguration class=java.io.FileInputStream 
constructor-arg value=C:/edaconfig/edaConfig.xml
type=java.lang.String/
/bean

bean id=edaOrchestratorCustom
class=com.softwareag.eda.orchestrator.api.EDAOrchestratorFactory
factory-method=createOrchestrator depends-on=streamConfiguration
constructor-arg ref=streamConfiguration 
type=java.io.InputStream/
/bean


bean id=testClient class=org.apache.camel.example.spring.TestClient
init-method=init 

Re: Odd info logs about startup w/ autoStartup=false

2011-12-05 Thread Jason Dillon
On Dec 1, 2011, at 1:33 AM, Claus Ibsen wrote:
 Yeah the wording could be improved. Any recommendation?

Is it important to log this information as INFO level?  I don't see any of the 
other attributes of a route logged in this fashion.  Is it common that folks 
set autoStartup(false) and then forget to start manually and wonder why a route 
is not started?

Wording wise, I think something like this may be better:

Route %s not started due to configured with autoStartup=false

or:

Skipping start of route %s; configured with autoStartup=false

--jason



Re: Camel message -How long custom headers and properties live

2011-12-05 Thread rspeter
Hi Christian,

The transferExchange options requires that the objects are serializable.
I tried with the options below, but there were errors.

inOnly uri=activemq:myqueue1?transferExchange=true
 inheritErrorHandler=true/ 


java.lang.RuntimeException: org.restlet.data.Parameter
at
org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:111)
at
org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:162)
at
org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:380)
at
org.apache.camel.component.jms.JmsBinding.createJmsMessage(JmsBinding.java:416)
at
org.apache.camel.component.jms.JmsBinding.makeJmsMessage(JmsBinding.java:267)
at
org.apache.camel.component.jms.JmsProducer$2.createMessage(JmsProducer.java:225)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.NotSerializableException: org.restlet.data.Parameter
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1346)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1154)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at java.util.HashMap.writeObject(HashMap.java:1001)

Regards
Peter

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-message-How-long-custom-headers-and-properties-live-tp5047495p5051051.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel message -How long custom headers and properties live

2011-12-05 Thread rspeter
Hi Claus,

Thanks for the reply. 
I needed to keep track of the variable/values across queues, so I am using
headers now and not property.
but I did try what Christian was saying, but it ended up in stack trace.

Regards
Peter

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-message-How-long-custom-headers-and-properties-live-tp5047495p5051058.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How can I handle exception message?

2011-12-05 Thread focaldi
Hi,

I want to do some special thing according to Exception Type. But there are a
lot of route and when an exeption occured I send the message to deadletter
queue.

errorHandler(
deadLetterChannel(jms:queue:deadletterqueue)
);

I wrote a class for deadletterchannel processor.

@Component(ProcessorForSendingEmail) 
public class ProcessorForSendingEmail implements Processor {

@Override
public void process(Exchange exchange) {

System.out.println(HATAA 
:+exchange.getOut().isFault());
System.out.println(Y
:+exchange.getOut().getHeader(Exchange.EXCEPTION_CAUGHT));
System.out.println(F :+exchange.getException());
System.out.println(HATAA 
:+exchange.getIn().isFault());
System.out.println(Y
:+exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT));

}

}


But all of them is null... I need to write Exception Message... How can I
reach exception message in Dead Queue. Thanks...
 

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-handle-exception-message-tp5051151p5051151.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel message -How long custom headers and properties live

2011-12-05 Thread rspeter
Hi Claus,

As I said earlier, I am using only header now.
But I have issues tracking the header again.

I used xpath to store value in a headerName='test. I can see this header
is visible only when I explicitly set its result type to string, otherwise
the headername is not visible.

Visible header:
setHeader headerName=testxpath
resultType=java.lang.String//*/data/text()/xpath/setHeader

NOT-Visible header:
setHeader headerName=testxpath//*/data/text()/xpath/setHeader 

Thanks
Peter   
 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-message-How-long-custom-headers-and-properties-live-tp5047495p5051169.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How can I handle exception message?

2011-12-05 Thread Claus Ibsen
Use exchange.getIn() to access the message.



On Tue, Dec 6, 2011 at 7:34 AM, focaldi ferit.oca...@tav.aero wrote:
 Hi,

 I want to do some special thing according to Exception Type. But there are a
 lot of route and when an exeption occured I send the message to deadletter
 queue.

        errorHandler(
                        deadLetterChannel(jms:queue:deadletterqueue)
        );

 I wrote a class for deadletterchannel processor.

 @Component(ProcessorForSendingEmail)
 public class ProcessorForSendingEmail implements Processor {

        @Override
        public void process(Exchange exchange) {

                System.out.println(HATAA 
 :+exchange.getOut().isFault());
                System.out.println(Y
 :+exchange.getOut().getHeader(Exchange.EXCEPTION_CAUGHT));
                System.out.println(F :+exchange.getException());
                System.out.println(HATAA 
 :+exchange.getIn().isFault());
                System.out.println(Y
 :+exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT));

        }

 }


 But all of them is null... I need to write Exception Message... How can I
 reach exception message in Dead Queue. Thanks...


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-can-I-handle-exception-message-tp5051151p5051151.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: How can I handle exception message?

2011-12-05 Thread Willem Jiang

Hi,

The exception is stored in the properties of exchange.
You can get it by using below code

Throwable exception = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, 
Throwable.class);


On Tue Dec  6 14:34:10 2011, focaldi wrote:

Hi,

I want to do some special thing according to Exception Type. But there are a
lot of route and when an exeption occured I send the message to deadletter
queue.

 errorHandler(
deadLetterChannel(jms:queue:deadletterqueue)
 );

I wrote a class for deadletterchannel processor.

@Component(ProcessorForSendingEmail)
public class ProcessorForSendingEmail implements Processor {

@Override
public void process(Exchange exchange) {

System.out.println(HATAA 
:+exchange.getOut().isFault());
System.out.println(Y
:+exchange.getOut().getHeader(Exchange.EXCEPTION_CAUGHT));
System.out.println(F :+exchange.getException());
System.out.println(HATAA 
:+exchange.getIn().isFault());
System.out.println(Y
:+exchange.getIn().getHeader(Exchange.EXCEPTION_CAUGHT));

}

}


But all of them is null... I need to write Exception Message... How can I
reach exception message in Dead Queue. Thanks...


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-handle-exception-message-tp5051151p5051151.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
Weibo: willemjiang


Re: How can I handle exception message?

2011-12-05 Thread focaldi
Thanks my friends, but it didnt work :(

In my main classs : 
...
camelContext.setHandleFault(true);
...

My Dead Letter Queue URL : 

jms:queue:deadletterqueue


Dead Letter Queueu Processor :
from(jms:queue:deadletterqueue).process(new ProcessorForSendingEmail ());

Processor class for deadletterqueue : 

@Component(ProcessorForSendingEmail) 
public class ProcessorForSendingEmail implements Processor {

@Override
public void process(Exchange exchange) {
Throwable exception =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,Throwable.class);
System.out.println(HATAA :+exception);
}

}

For test I throw an exception from a proccessor : 

@Component(Test3) 
public class Test3 implements Processor {

@Override
public void process(Exchange exchange) throws Exception {
if (1==1) throw new Exception(BENDEE);
exchange.getIn().setHeader(IB.messageName, rmsPlstAssign);
}

}

Result : HATAA :null

I NEED EXCEPTION MESSAGE... Please help me :(

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-handle-exception-message-tp5051151p5051266.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How can I handle exception message?

2011-12-05 Thread Claus Ibsen
If you use a JMS destination as dead letter channel, then it only
stores the message. Not the stacktrace.

If you want to include the stacktrace, you will have to put that into
the message as a header yourself, and ensure the value of the header
is valid according to the JMS spec, such as a java.lang.String type.

See the JMS wiki page for details about mapping to/from JMS.


On Tue, Dec 6, 2011 at 8:25 AM, focaldi ferit.oca...@tav.aero wrote:
 Thanks my friends, but it didnt work :(

 In my main classs :
 ...
 camelContext.setHandleFault(true);
 ...

 My Dead Letter Queue URL :

 jms:queue:deadletterqueue


 Dead Letter Queueu Processor :
 from(jms:queue:deadletterqueue).process(new ProcessorForSendingEmail ());

 Processor class for deadletterqueue :

 @Component(ProcessorForSendingEmail)
 public class ProcessorForSendingEmail implements Processor {

        @Override
        public void process(Exchange exchange) {
                Throwable exception =
 exchange.getProperty(Exchange.EXCEPTION_CAUGHT,Throwable.class);
                System.out.println(HATAA :+exception);
        }

 }

 For test I throw an exception from a proccessor :

 @Component(Test3)
 public class Test3 implements Processor {

        @Override
        public void process(Exchange exchange) throws Exception {
                if (1==1) throw new Exception(BENDEE);
                exchange.getIn().setHeader(IB.messageName, rmsPlstAssign);
        }

 }

 Result : HATAA :null

 I NEED EXCEPTION MESSAGE... Please help me :(

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-can-I-handle-exception-message-tp5051151p5051266.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: How can I handle exception message?

2011-12-05 Thread Willem Jiang
You are using the jms endpoint to receive the message, you need to 
enable the transferExchange option and make sure your exceptions are 
serializable.


On Tue Dec  6 15:25:42 2011, focaldi wrote:

Thanks my friends, but it didnt work :(

In my main classs :
...
camelContext.setHandleFault(true);
...

My Dead Letter Queue URL :

jms:queue:deadletterqueue


Dead Letter Queueu Processor :
from(jms:queue:deadletterqueue).process(new ProcessorForSendingEmail ());

Processor class for deadletterqueue :

@Component(ProcessorForSendingEmail)
public class ProcessorForSendingEmail implements Processor {

@Override
public void process(Exchange exchange) {
Throwable exception =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,Throwable.class);
System.out.println(HATAA :+exception);  
}

}

For test I throw an exception from a proccessor :

@Component(Test3)
public class Test3 implements Processor {

@Override
public void process(Exchange exchange) throws Exception {
if (1==1) throw new Exception(BENDEE);
exchange.getIn().setHeader(IB.messageName, rmsPlstAssign);
}

}

Result : HATAA :null

I NEED EXCEPTION MESSAGE... Please help me :(

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-handle-exception-message-tp5051151p5051266.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
Weibo: willemjiang