You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mick Knutson <mk...@baselogic.com> on 2008/09/26 21:22:50 UTC

issue routing Exchange to custom method in Processor

I have a Processor with 2 different methods:

The standard:
*public void process(Exchange exchange) {
*

and a custom:

    *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
    public void onMessage(Exchange exchange) *

Now here is my route:

       * from(Constants.CHANNEL_GG_CS_CR_ADD)
                .errorHandler(

deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
//.maximumRedeliveries(2)
                                //.initialRedeliveryDelay(1)
                                .loggingLevel(LoggingLevel.DEBUG)
                ).processRef("changeRequestController")
                .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);


        // Route for command status updates.
        from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
                .errorHandler(

deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
                                .initialRedeliveryDelay(1)
                                .loggingLevel(LoggingLevel.INFO)
                ).to("bean:changeRequestController?methodName=onMessage");
*

So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
process(Exchange) method is called, and that rout is fine.

However, I get a response message back on
**Constants.CHANNEL_GG_CS_COMMAND_STATUS
but it is also processed by *the *process(Exchange) instead of my onMessage*
*(Exchange)*

I have tried @MessageDriven annotation as well as the route builder but
neither works.

Am I forced to have each process in a single class?



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
It almost appears that there might be some issue with mock endpoint
resetting?



On Wed, Oct 1, 2008 at 12:02 PM, Mick Knutson <mk...@baselogic.com>wrote:

> I am going crazy here (literally).
>
> This is all I know at this point.
>
> If I use this method exacly as I have it (endpoint names), then all my
> tests pass as expected. But if I change anything in the endpoint names, even
> to be mock:success, verse mock:success1 then several of my tests fail with
> messages not getting routed correctly:
>
>     *public void testCreateInvalidChangeRequest(String
> inputDestinationURI,
>                                                String messageInputBody,
>                                                String messageOutputBody
>     )
>             throws Exception {
>
>         MockEndpoint mockFailureEndpoint = getMockEndpoint("mock:failed1
> ");
>         MockEndpoint mockSuccessEndpoint = getMockEndpoint("mock:success1
> ");
>
>         mockFailureEndpoint.expectedBodiesReceived(messageInputBody);
>         mockFailureEndpoint.expectedMessageCount(1);
>         mockSuccessEndpoint.expectedMessageCount(0);
>
>         try {
>             camelContext.addRoutes(new RouteBuilder() {
>                 public void configure() throws Exception {
>                     from("direct:start1")
>                             .errorHandler(deadLetterChannel("mock:failed1
> "))
>                             .process(changeRequestProcessor)
>                             .to("mock:success1");
>                 }
>             });
>
>             producerTemplate.sendBody("direct:start1", messageInputBody);
>
>             Assert.fail("Should have thrown a RuntimeCamelException");
>         } catch (RuntimeCamelException e) {
>             //assertIsInstanceOf(e, IllegalArgumentException.class);
>             assertIsInstanceOf(e, RuntimeCamelException.class);
>         }
>
>         testMocksAreValid();
>
>         MockEndpoint.assertIsSatisfied(mockFailureEndpoint,
> mockSuccessEndpoint);
>
>     }
> *
>
> I have attached my basetest, and this test in question as well.
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
I am going crazy here (literally).

This is all I know at this point.

If I use this method exacly as I have it (endpoint names), then all my tests
pass as expected. But if I change anything in the endpoint names, even to be
mock:success, verse mock:success1 then several of my tests fail with
messages not getting routed correctly:

    *public void testCreateInvalidChangeRequest(String inputDestinationURI,
                                               String messageInputBody,
                                               String messageOutputBody
    )
            throws Exception {

        MockEndpoint mockFailureEndpoint = getMockEndpoint("mock:failed1");
        MockEndpoint mockSuccessEndpoint = getMockEndpoint("mock:success1");

        mockFailureEndpoint.expectedBodiesReceived(messageInputBody);
        mockFailureEndpoint.expectedMessageCount(1);
        mockSuccessEndpoint.expectedMessageCount(0);

        try {
            camelContext.addRoutes(new RouteBuilder() {
                public void configure() throws Exception {
                    from("direct:start1")
                            .errorHandler(deadLetterChannel("mock:failed1"))
                            .process(changeRequestProcessor)
                            .to("mock:success1");
                }
            });

            producerTemplate.sendBody("direct:start1", messageInputBody);

            Assert.fail("Should have thrown a RuntimeCamelException");
        } catch (RuntimeCamelException e) {
            //assertIsInstanceOf(e, IllegalArgumentException.class);
            assertIsInstanceOf(e, RuntimeCamelException.class);
        }

        testMocksAreValid();

        MockEndpoint.assertIsSatisfied(mockFailureEndpoint,
mockSuccessEndpoint);

    }
*

I have attached my basetest, and this test in question as well.

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Mick

Using 1.4 you should also remove the assertion:
            Assert.fail("Should have thrown a RuntimeCamelException");


However on 1.5 (if / when you upgrade):
- you need the try .. catch (and the assertion)


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 30. september 2008 21:40
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

I tried this new method as your instructions first with 1.4


*New Method:*

    *protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")

.errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(1))
                        .process(new Processor() {
                            public void process(Exchange exchange) throws
Exception {
                                String body =
exchange.getIn().getBody(String.class);
                                if ("Boom".equals(body)) {
                                    throw new
IllegalArgumentException("Forced exception by unit test");
                                }
                                exchange.getIn().setBody("Bye World");
                            }
                        })
                        .to("mock:result");
            }
        };
    }

    @Test(groups = {"functional"})
    public void testError() throws Exception {

        camelContext.addRoutes(createRouteBuilder());

        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        MockEndpoint error = getMockEndpoint("mock:error");
        MockEndpoint result = getMockEndpoint("mock:result");
        error.expectedMessageCount(1);
        result.expectedMessageCount(0);

        //try {
            producerTemplate.sendBody("direct:start", "Boom");

            Assert.fail("Should have thrown a RuntimeCamelException");
        //} catch (RuntimeCamelException e) {
            //assertIsInstanceOf(IllegalArgumentException.class,
e.getCause());
        //}

        MockEndpoint.assertIsSatisfied(error, result);
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
    }

*



*My TestNG results:*

  *      <test name="MockTest">
      <class name="com.servepath.changerequest.ChangeRequestTest">
        <test-method status="FAIL" signature="testError()" name="testError"
duration-ms="375" started-at="2008-09-30T12:38:09Z"
finished-at="2008-09-30T12:38:09Z">
          <exception class="java.lang.AssertionError">
            <message>
              <![CDATA[Should have thrown a RuntimeCamelException]]>
            </message>
            <full-stacktrace>
              <![CDATA[java.lang.AssertionError: Should have thrown a
RuntimeCamelException
    at org.testng.Assert.fail(Assert.java:84)
    at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
    at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
    at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
    at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
    at org.testng.TestRunner.privateRun(TestRunner.java:582)
    at org.testng.TestRunner.run(TestRunner.java:477)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
    at org.testng.TestNG.run(TestNG.java:708)
    at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
    at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
]]>
            </full-stacktrace>
          </exception>
        </test-method>
*


*Console Output:*

*[myproject] DEBUG [main] DefaultComponent.createEndpoint(77) | Creating
endpoint uri=[direct:start], path=[start], parameters=[{}]
[myproject] DEBUG [main] DefaultCamelContext.getEndpoint(281) | direct:start
converted to endpoint: Endpoint[direct:start] by component: org.apache.ca
mel.component.direct.DirectComponent@b49b19
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,type=endpoint,component=direct,name=start
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,route=[direct]start,type=processor,nodeid=process4,name="process[com.servepath.changerequest.ChangeRequestTest$1$1@132be10
]"
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,route=[direct]start,type=processor,nodeid=to5,name="To[mock:result]"
[myproject] DEBUG [main] DefaultComponent.createEndpoint(77) | Creating
endpoint uri=[mock:result], path=[result], parameters=[{}]
[myproject] DEBUG [main] DefaultCamelContext.getEndpoint(281) | mock:result
converted to endpoint: Endpoint[mock:result] by component: org.apache.came
l.component.mock.MockComponent@6691da
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,type=endpoint,component=mock,name=result
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,route=[direct]start,type=route,name=[direct]start
[myproject] DEBUG [main] DefaultCamelContext.addRoutes(354) | Adding routes
from: Routes: [Route[ [From[direct:start]] -> [Interceptor[Delegate(Pipeli
ne[DeadLetterChannel[Delegate(com.servepath.changerequest.ChangeRequestTest$1$1@132be10),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeli
veries=1, initialRedeliveryDelay=1000, maximumRedeliveryDelay=60000,
useExponentialBackOff=false, backOffMultiplier=2.0,
useCollisionAvoidance=false,
collisionAvoidanceFactor=0.15]],
DeadLetterChannel[Delegate(sendTo(Endpoint[mock:result])),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRede
liveries=1, initialRedeliveryDelay=1000, maximumRedeliveryDelay=60000,
useExponentialBackOff=false, backOffMultiplier=2.0,
useCollisionAvoidance=false
, collisionAvoidanceFactor=0.15]]])]]]] routes: []
[myproject] INFO [main] ChangeRequestTest.testError(60) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(61) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(62) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(63) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(64) |
----------------------------------------------------
[myproject] DEBUG [main] ProducerCache.sendExchange(149) | >>>>
Endpoint[direct:start] Exchange[Message: Boom]
[myproject] ERROR [main] DeadLetterChannel.log(188) | Failed delivery for
exchangeId: ID-mickknutson/1230-1222803205187/0-0. On delivery attempt: 0 ca
ught: java.lang.IllegalArgumentException: Forced exception by unit test
java.lang.IllegalArgumentException: Forced exception by unit test
        at
com.servepath.changerequest.ChangeRequestTest$1$1.process(ChangeRequestTest.java:45)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:75)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:174)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:96)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:63)
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:47)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
        at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)
        at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:151)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:88)
        at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:85)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:102)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:108)
        at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
        at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
        at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
        at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
        at
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
        at org.testng.TestRunner.runWorkers(TestRunner.java:712)
        at org.testng.TestRunner.privateRun(TestRunner.java:582)
        at org.testng.TestRunner.run(TestRunner.java:477)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
        at org.testng.SuiteRunner.run(SuiteRunner.java:198)
        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
        at org.testng.TestNG.run(TestNG.java:708)
        at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
        at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
[myproject] DEBUG [main]
DefaultExceptionPolicyStrategy.getExceptionPolicy(46) | Finding best suited
exception policy for thrown exception java.lang.I
llegalArgumentException
[myproject] DEBUG [main]
DefaultExceptionPolicyStrategy.getExceptionPolicy(87) | No candidate found
to be used as exception policy
[myproject] DEBUG [main] RedeliveryPolicy.sleep(104) | Sleeping for: 1000
millis until attempting redelivery*

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
I tried this new method as your instructions first with 1.4


*New Method:*

    *protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")

.errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(1))
                        .process(new Processor() {
                            public void process(Exchange exchange) throws
Exception {
                                String body =
exchange.getIn().getBody(String.class);
                                if ("Boom".equals(body)) {
                                    throw new
IllegalArgumentException("Forced exception by unit test");
                                }
                                exchange.getIn().setBody("Bye World");
                            }
                        })
                        .to("mock:result");
            }
        };
    }

    @Test(groups = {"functional"})
    public void testError() throws Exception {

        camelContext.addRoutes(createRouteBuilder());

        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        MockEndpoint error = getMockEndpoint("mock:error");
        MockEndpoint result = getMockEndpoint("mock:result");
        error.expectedMessageCount(1);
        result.expectedMessageCount(0);

        //try {
            producerTemplate.sendBody("direct:start", "Boom");

            Assert.fail("Should have thrown a RuntimeCamelException");
        //} catch (RuntimeCamelException e) {
            //assertIsInstanceOf(IllegalArgumentException.class,
e.getCause());
        //}

        MockEndpoint.assertIsSatisfied(error, result);
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
        log.info("----------------------------------------------------");
    }

*



*My TestNG results:*

  *      <test name="MockTest">
      <class name="com.servepath.changerequest.ChangeRequestTest">
        <test-method status="FAIL" signature="testError()" name="testError"
duration-ms="375" started-at="2008-09-30T12:38:09Z"
finished-at="2008-09-30T12:38:09Z">
          <exception class="java.lang.AssertionError">
            <message>
              <![CDATA[Should have thrown a RuntimeCamelException]]>
            </message>
            <full-stacktrace>
              <![CDATA[java.lang.AssertionError: Should have thrown a
RuntimeCamelException
    at org.testng.Assert.fail(Assert.java:84)
    at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
    at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
    at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
    at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
    at org.testng.TestRunner.privateRun(TestRunner.java:582)
    at org.testng.TestRunner.run(TestRunner.java:477)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
    at org.testng.TestNG.run(TestNG.java:708)
    at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
    at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
]]>
            </full-stacktrace>
          </exception>
        </test-method>
*


*Console Output:*

*[myproject] DEBUG [main] DefaultComponent.createEndpoint(77) | Creating
endpoint uri=[direct:start], path=[start], parameters=[{}]
[myproject] DEBUG [main] DefaultCamelContext.getEndpoint(281) | direct:start
converted to endpoint: Endpoint[direct:start] by component: org.apache.ca
mel.component.direct.DirectComponent@b49b19
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,type=endpoint,component=direct,name=start
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,route=[direct]start,type=processor,nodeid=process4,name="process[com.servepath.changerequest.ChangeRequestTest$1$1@132be10
]"
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,route=[direct]start,type=processor,nodeid=to5,name="To[mock:result]"
[myproject] DEBUG [main] DefaultComponent.createEndpoint(77) | Creating
endpoint uri=[mock:result], path=[result], parameters=[{}]
[myproject] DEBUG [main] DefaultCamelContext.getEndpoint(281) | mock:result
converted to endpoint: Endpoint[mock:result] by component: org.apache.came
l.component.mock.MockComponent@6691da
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,type=endpoint,component=mock,name=result
[myproject] DEBUG [main]
DefaultInstrumentationAgent.registerMBeanWithServer(247) | Registered MBean
with objectname: org.apache.camel:context=mickknu
tson/camel,route=[direct]start,type=route,name=[direct]start
[myproject] DEBUG [main] DefaultCamelContext.addRoutes(354) | Adding routes
from: Routes: [Route[ [From[direct:start]] -> [Interceptor[Delegate(Pipeli
ne[DeadLetterChannel[Delegate(com.servepath.changerequest.ChangeRequestTest$1$1@132be10),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeli
veries=1, initialRedeliveryDelay=1000, maximumRedeliveryDelay=60000,
useExponentialBackOff=false, backOffMultiplier=2.0,
useCollisionAvoidance=false,
collisionAvoidanceFactor=0.15]],
DeadLetterChannel[Delegate(sendTo(Endpoint[mock:result])),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRede
liveries=1, initialRedeliveryDelay=1000, maximumRedeliveryDelay=60000,
useExponentialBackOff=false, backOffMultiplier=2.0,
useCollisionAvoidance=false
, collisionAvoidanceFactor=0.15]]])]]]] routes: []
[myproject] INFO [main] ChangeRequestTest.testError(60) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(61) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(62) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(63) |
----------------------------------------------------
[myproject] INFO [main] ChangeRequestTest.testError(64) |
----------------------------------------------------
[myproject] DEBUG [main] ProducerCache.sendExchange(149) | >>>>
Endpoint[direct:start] Exchange[Message: Boom]
[myproject] ERROR [main] DeadLetterChannel.log(188) | Failed delivery for
exchangeId: ID-mickknutson/1230-1222803205187/0-0. On delivery attempt: 0 ca
ught: java.lang.IllegalArgumentException: Forced exception by unit test
java.lang.IllegalArgumentException: Forced exception by unit test
        at
com.servepath.changerequest.ChangeRequestTest$1$1.process(ChangeRequestTest.java:45)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:75)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:174)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:96)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:63)
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:47)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
        at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)
        at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:151)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:88)
        at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:85)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:102)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:108)
        at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
        at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
        at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
        at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
        at
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
        at org.testng.TestRunner.runWorkers(TestRunner.java:712)
        at org.testng.TestRunner.privateRun(TestRunner.java:582)
        at org.testng.TestRunner.run(TestRunner.java:477)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
        at org.testng.SuiteRunner.run(SuiteRunner.java:198)
        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
        at org.testng.TestNG.run(TestNG.java:708)
        at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
        at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
        at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
[myproject] DEBUG [main]
DefaultExceptionPolicyStrategy.getExceptionPolicy(46) | Finding best suited
exception policy for thrown exception java.lang.I
llegalArgumentException
[myproject] DEBUG [main]
DefaultExceptionPolicyStrategy.getExceptionPolicy(87) | No candidate found
to be used as exception policy
[myproject] DEBUG [main] RedeliveryPolicy.sleep(104) | Sleeping for: 1000
millis until attempting redelivery*

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

If you stay with 1.4 then remove the try .. catch around the producer template. This is new behavior in 1.5.

See release notes:
http://activemq.apache.org/camel/camel-150-release.html

Mind that 1.5 is still work in progress, however we are closing in on the first RC sooner than later.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 30. september 2008 19:15
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

1.4

Let me do a test with 1.5

On Tue, Sep 30, 2008 at 10:10 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi Mick
>
> What version are you using?
>
> The unit test I created is with camel 1.5-SNAPSHOT.
>
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 30. september 2008 18:39
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> *I took the exact test method and create Route you had in that test:*
>
>
>    *protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() throws Exception {
>                from("direct:start")
>
> .errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(1))
>                        .process(new Processor() {
>                            public void process(Exchange exchange) throws
> Exception {
>                                String body =
> exchange.getIn().getBody(String.class);
>                                if ("Boom".equals(body)) {
>                                    throw new
> IllegalArgumentException("Forced exception by unit test");
>                                }
>                                exchange.getIn().setBody("Bye World");
>                            }
>                        })
>                        .to("mock:result");
>            }
>        };
>    }
>
>    @Test(groups = {"functional"})
>    public void testError() throws Exception {
>
>        camelContext.addRoutes(createRouteBuilder());
>
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        MockEndpoint error = getMockEndpoint("mock:error");
>        MockEndpoint result = getMockEndpoint("mock:result");
>        error.expectedMessageCount(1);
>        result.expectedMessageCount(0);
>
>        try {
>            producerTemplate.sendBody("direct:start", "Boom");
>            Assert.fail("Should have thrown a RuntimeCamelException");
>        } catch (RuntimeCamelException e) {
>            //assertIsInstanceOf(IllegalArgumentException.class,
> e.getCause());
>        }
>
>        MockEndpoint.assertIsSatisfied(error, result);
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>    }
> *
>
>
>
>
>
>
> *And ran that in my TestNG and no failure occures:*
>
>    *<test name="MockTest">
>      <class name="com.servepath.changerequest.ChangeRequestTest">
>        <test-method status="FAIL" signature="testError()" name="testError"
> duration-ms="375" started-at="2008-09-30T09:34:04Z"
> finished-at="2008-09-30T09:34:04Z">
>          <exception class="java.lang.AssertionError">
>            <message>
>              <![CDATA[Should have thrown a RuntimeCamelException]]>
>            </message>
>            <full-stacktrace>
>              <![CDATA[java.lang.AssertionError: Should have thrown a
> RuntimeCamelException
>    at org.testng.Assert.fail(Assert.java:84)
>    at
>
> com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:73)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
>    at
> org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
>    at
>
> org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at
> org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
>    at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
>    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
>    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
>    at
>
> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
>    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
>    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
>    at org.testng.TestRunner.privateRun(TestRunner.java:582)
>    at org.testng.TestRunner.run(TestRunner.java:477)
>    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
>    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
>    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
>    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
>    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
>    at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
>    at org.testng.TestNG.run(TestNG.java:708)
>    at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
>    at
>
> org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
>    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at
>
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
>    at
>
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
> ]]>
>            </full-stacktrace>
> *
>
>
> *Here is the console trace for this test:
> *
> *tson/camel,route=[direct]start,type=route,name=[direct]start
> [myproject] DEBUG [main] DefaultCamelContext.addRoutes(341) | Adding routes
> from: Routes: [Route[ [From[direct:start]] -> [Interceptor[Delegate(Pipeli
>
> ne[DeadLetterChannel[Delegate(com.servepath.changerequest.ChangeRequestTest$1$1@188f506
> ),
> sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeli
> veries=1]], DeadLetterChannel[Delegate(sendTo(Endpoint[mock:result])),
> sendTo(Endpoint[mock:error]),
> RedeliveryPolicy[maximumRedeliveries=1]]])]]]]
> ro
> utes: []
> [myproject] DEBUG [main] ProducerCache.sendExchange(147) | >>>>
> Endpoint[direct:start] Exchange[Message: Boom]
> [myproject] ERROR [main] DeadLetterChannel.log(189) | Failed delivery for
> exchangeId: ID-mickknutson/2161-1222792429368/0-0. On delivery attempt: 0
> ca
> ught: java.lang.IllegalArgumentException: Forced exception by unit test
> java.lang.IllegalArgumentException: Forced exception by unit test
>        at
>
> com.servepath.changerequest.ChangeRequestTest$1$1.process(ChangeRequestTest.java:46)
>        at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
>        at
>
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
>        at
>
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
>        at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
>        at
>
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
>        at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
>        at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
>        at
>
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)
>        at
> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:149)
>        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:86)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:84)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:101)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:107)
>        at
>
> com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:72)
> *
>
>
>
> On Mon, Sep 29, 2008 at 9:49 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi Mick
> >
> > Check out this unit test I just added:
> >
> > If you are using 1.5-SNAPSHOT remember that the producer template now
> > rethrows the exception that caused the failure in the routing. So you
> should
> > try .. catch this no. See the ErrorHandlerTest#testError() method.
> >
> > http://svn.apache.org/viewvc?view=rev&revision=700334
> >
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Claus Ibsen [mailto:ci@silverbullet.dk]
> > Sent: 30. september 2008 06:25
> > To: camel-user@activemq.apache.org
> > Subject: RE: issue routing Exchange to custom method in Processor
> >
> > Hi
> >
> > Could you put the error handler outside the from, so its like this:
> >
> > errorHandler(xxx);
> > from(yyy).process(zzz);
> >
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 30. september 2008 00:33
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I have looked through this whole thing, and there is nothing different
> than
> > what I am doing.
> >
> > My valid tests work fine. They get the expected messages and validate
> > accordingly. But the issue seems to be with processing deadLetter
> channels
> > in Mocks.
> >
> > So basically, in my test, the message is sent through to the
> > *resultEndpoint
> > *instead of the *resultErrorEndpoint *which is causing my test to fail.
> >
> >
> > Now just before I test my Mock's, I added this code to:
> >
> >        *Assert.assertNotNull(camelContext);
> >        Assert.assertNotNull(resultEndpoint);
> >        Assert.assertNotNull(resultErrorEndpoint);
> >
> >        //MockEndpoint.assertIsSatisfied(camelContext);
> >
> >        // lets show the endpoints in the test
> >        List<MockEndpoint> list =
> > CamelContextHelper.getSingletonEndpoints(camelContext,
> MockEndpoint.class);
> >        log.info("Found endpoints: " + list);
> >
> >        // lets dump the messages sent to our test endpoint
> >        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
> >        log.info
> >
> >
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> >        for (Exchange exchange : exchanges) {
> >            log.info("Received resultEndpoint: [" + exchange + "]\n");
> >        }
> >
> >        // lets dump the messages sent to our test endpoint
> >        List<Exchange> exchangesMock =
> > resultErrorEndpoint.getReceivedExchanges();
> >        log.info
> >
> >
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> >        for (Exchange exchange : exchangesMock) {
> >            log.info("Received resultErrorEndpoint: [" + exchange +
> "]\n");
> >        }
> >        log.info
> >
> >
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> > *
> >
> >
> > *And there is nothing happening to my error mock at all.*
> >
> >
> > *[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
> > testMocksAreValid
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
> > endpoints: [Endpoint[mock:outputDestinationURI],
> > Endpoint[mock:outputErrorDes
> > tinationURI]]
> > [myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
> > consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
> >
> >
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %%%%%%%%%%%
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) |
> Received
> > resultEndpoint: [Exchange[JmsMessage:
> {"changeRequestId":"99907","custId":
> > "70999","requestType":"provision","quota":"102400","backend":"
> > 192.168.0.0/16
> > ","password":"abcd1234"}]]
> >
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) |
> Received
> > resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
> > responseRequired = true, messageId =
> > ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
> > originalTransactionId = null, producerI
> > d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
> > queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
> > expiration = 0
> > , timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
> > brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
> > persisten
> > t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
> > targetConsumerId = null, compressed = false, userID = null, content =
> null,
> > ma
> > rshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> > size
> > = 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
> > , droppable = false, text =
> >
> >
> {"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]
> >
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
> >
> >
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %%%%%%%%%%%
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
> >
> >
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %%%%%%%%%%%
> > *
> >
> > So there are 2 exchanges only. The first in green was for my initial add
> > request which was successful. The second for for my status update in
> > orange,
> > which was also successful.
> >
> > What I do NOT have is any exchange whatsoever for my failed request.
> >
> >
> >
> > So according to my <test name="*InvalidProvisionChangeRequest*">
> > *<message>
> > *
> > *              <![CDATA[mock:outputDestinationURI Received message
> > count. Expected:
> > <0> but was: <1>]]>
> >            </message>*
> >
> > Which means that nothing is getting routed to my deadLetter Channel in my
> > tests only.
> >
> >
> >
> >
> > On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > >
> > >
> >
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
> > >
> > > It is in fact not promoted too much (or not at all) on our camel wiki
> > > documentation.
> > >
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > >
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 19:57
> > > To: camel-user@activemq.apache.org
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > I deploy this as a war to Tomcat and use a single
> applicationContext.xml
> > to
> > > start camel like:
> > >
> > > *<import resource="classpath:META-INF/spring/camel-context.xml"/>
> > >
> > > <camelContext id="camel"
> > >                  xmlns="http://activemq.apache.org/camel/schema/spring
> ">
> > >        <!-- The routes are defined in -->
> > >        <package>com.servepath.gogrid.changerequest</package>
> > >
> > >    </camelContext>
> > > *
> > >
> > >
> > > The same as in my applicationContext-test.xml except I do not include
> any
> > > routing declarations as I have my test create the route like:
> > >
> > >
> > >    public void setRoutes(final String inputUri, final Processor
> > processor)
> > >            throws Exception {
> > >        // Add Routes to Camel Context
> > >        camelContext.addRoutes(new RouteBuilder() {
> > >            public void configure() {
> > >                from(inputUri)
> > >                        .errorHandler(
> > >
> > > deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
> > >
>  .loggingLevel(LoggingLevel.TRACE)
> > >
> > >                        )
> > >                        .process(changeRequestController)
> > >                        .to(MOCK_OUTPUT_DESTINATION_URI);
> > >            }
> > >        });
> > >
> > >    }//setRoutes
> > >
> > >
> > > PS, where can I find this camel TestNG component you are talking about?
> > >
> > >
> > >
> > >
> > >
> > > On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I think it could be how you start camel. When you deploy to Jetty do
> > you
> > > > deploy it as OSGi bundles, or as a web application?
> > > >
> > > > Either way then its usually Spring that is starting up as normal and
> it
> > > > will starup Camel properly.
> > > >
> > > > I am not sure this is happening correctly in your unit tests.
> > > >
> > > > Your BaseCamelTestNG class also starts Camel. It is only supposed to
> be
> > > > started once. As well as stopped, let Spring handle this.
> > > >
> > > > There must be a hook somewhere where you can add your routes. However
> > we
> > > > use either plain junit or spring junit based in the testing of camel
> > > itself
> > > > - not TestNG so I am afraid I have not used it that much.
> > > >
> > > > Could you check out the camel-testng component. It might have some
> > > pointers
> > > > there.
> > > >
> > > >
> > > > Med venlig hilsen
> > > >
> > > > Claus Ibsen
> > > > ......................................
> > > > Silverbullet
> > > > Skovsgårdsvænget 21
> > > > 8362 Hørning
> > > > Tlf. +45 2962 7576
> > > > Web: www.silverbullet.dk
> > > >
> > > > -----Original Message-----
> > > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > > Sent: 29. september 2008 19:26
> > > > To: camel-user@activemq.apache.org
> > > > Subject: Re: issue routing Exchange to custom method in Processor
> > > >
> > > > I have seperated them and that solves the first item. Thanks.
> > > > But I still can't seem to get my errorMock to work.
> > > >
> > > > But when I deploy this to Jetty, the route and errors act as
> expected.
> > > >
> > > >
> > > > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> > > wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > I don't think you should have both @MessageDriven and Processor in
> > the
> > > > same
> > > > > java class. You should separate these two. This is not commonly
> used.
> > > > >
> > > > >
> > > > > Med venlig hilsen
> > > > >
> > > > > Claus Ibsen
> > > > > ......................................
> > > > > Silverbullet
> > > > > Skovsgårdsvænget 21
> > > > > 8362 Hørning
> > > > > Tlf. +45 2962 7576
> > > > > Web: www.silverbullet.dk
> > > > > -----Original Message-----
> > > > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > > > Sent: 29. september 2008 18:12
> > > > > To: Camel; Active MQ
> > > > > Subject: Re: issue routing Exchange to custom method in Processor
> > > > >
> > > > > Can someone help me?
> > > > >
> > > > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <
> > mknutson@baselogic.com
> > > > > >wrote:
> > > > >
> > > > > > The funny thing is, when I have an error with the message coming
> > from
> > > > > this
> > > > > > queue, which I do because process(Exchange) does not expect my
> > > message
> > > > > body,
> > > > > > the message gets routed to the proper deadLetter channel.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> > > mknutson@baselogic.com
> > > > > >wrote:
> > > > > >
> > > > > >> I have a Processor with 2 different methods:
> > > > > >>
> > > > > >> The standard:
> > > > > >> *public void process(Exchange exchange) {
> > > > > >> *
> > > > > >>
> > > > > >> and a custom:
> > > > > >>
> > > > > >>     *@MessageDriven(uri =
> Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > > >>     public void onMessage(Exchange exchange) *
> > > > > >>
> > > > > >> Now here is my route:
> > > > > >>
> > > > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > > > >>                 .errorHandler(
> > > > > >>
> > > > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > > > >> //.maximumRedeliveries(2)
> > > > > >>                                 //.initialRedeliveryDelay(1)
> > > > > >>
> .loggingLevel(LoggingLevel.DEBUG)
> > > > > >>                 ).processRef("changeRequestController")
> > > > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > > > >>
> > > > > >>
> > > > > >>         // Route for command status updates.
> > > > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > > >>                 .errorHandler(
> > > > > >>
> > > > > >>
> > > > >
> > > >
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > > > >>                                 .initialRedeliveryDelay(1)
> > > > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > > > >>
> > > > > ).to("bean:changeRequestController?methodName=onMessage");
> > > > > >> *
> > > > > >>
> > > > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > > > >> process(Exchange) method is called, and that rout is fine.
> > > > > >>
> > > > > >> However, I get a response message back on
> > > > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > > > >> but it is also processed by *the *process(Exchange) instead of
> my
> > > > > >> onMessage**(Exchange)*
> > > > > >>
> > > > > >> I have tried @MessageDriven annotation as well as the route
> > builder
> > > > but
> > > > > >> neither works.
> > > > > >>
> > > > > >> Am I forced to have each process in a single class?
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> --
> > > > > >> ---
> > > > > >> Thank You...
> > > > > >>
> > > > > >> Mick Knutson
> > > > > >> BASE Logic, inc.
> > > > > >> (415) 354-4215
> > > > > >>
> > > > > >> Website: http://baselogic.com
> > > > > >> Blog: http://baselogic.com/blog
> > > > > >> BLiNC Magazine: http://blincmagazine.com
> > > > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > > > >> DJ Mick: http://djmick.com
> > > > > >> MySpace: http://myspace.com/mickknutson
> > > > > >> Vacation Rental: http://tahoe.baselogic.com
> > > > > >>
> > > > > >>
> > > > > >
> > > > > >
> > > > > > --
> > > > > > ---
> > > > > > Thank You...
> > > > > >
> > > > > > Mick Knutson
> > > > > > BASE Logic, inc.
> > > > > > (415) 354-4215
> > > > > >
> > > > > > Website: http://baselogic.com
> > > > > > Blog: http://baselogic.com/blog
> > > > > > BLiNC Magazine: http://blincmagazine.com
> > > > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > > > DJ Mick: http://djmick.com
> > > > > > MySpace: http://myspace.com/mickknutson
> > > > > > Vacation Rental: http://tahoe.baselogic.com
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > ---
> > > > > Thank You...
> > > > >
> > > > > Mick Knutson
> > > > > BASE Logic, inc.
> > > > > (415) 354-4215
> > > > >
> > > > > Website: http://baselogic.com
> > > > > Blog: http://baselogic.com/blog
> > > > > BLiNC Magazine: http://blincmagazine.com
> > > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > > DJ Mick: http://djmick.com
> > > > > MySpace: http://myspace.com/mickknutson
> > > > > Vacation Rental: http://tahoe.baselogic.com
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
1.4

Let me do a test with 1.5

On Tue, Sep 30, 2008 at 10:10 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi Mick
>
> What version are you using?
>
> The unit test I created is with camel 1.5-SNAPSHOT.
>
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 30. september 2008 18:39
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> *I took the exact test method and create Route you had in that test:*
>
>
>    *protected RouteBuilder createRouteBuilder() throws Exception {
>        return new RouteBuilder() {
>            public void configure() throws Exception {
>                from("direct:start")
>
> .errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(1))
>                        .process(new Processor() {
>                            public void process(Exchange exchange) throws
> Exception {
>                                String body =
> exchange.getIn().getBody(String.class);
>                                if ("Boom".equals(body)) {
>                                    throw new
> IllegalArgumentException("Forced exception by unit test");
>                                }
>                                exchange.getIn().setBody("Bye World");
>                            }
>                        })
>                        .to("mock:result");
>            }
>        };
>    }
>
>    @Test(groups = {"functional"})
>    public void testError() throws Exception {
>
>        camelContext.addRoutes(createRouteBuilder());
>
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        MockEndpoint error = getMockEndpoint("mock:error");
>        MockEndpoint result = getMockEndpoint("mock:result");
>        error.expectedMessageCount(1);
>        result.expectedMessageCount(0);
>
>        try {
>            producerTemplate.sendBody("direct:start", "Boom");
>            Assert.fail("Should have thrown a RuntimeCamelException");
>        } catch (RuntimeCamelException e) {
>            //assertIsInstanceOf(IllegalArgumentException.class,
> e.getCause());
>        }
>
>        MockEndpoint.assertIsSatisfied(error, result);
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>        log.debug("----------------------------------------------------");
>    }
> *
>
>
>
>
>
>
> *And ran that in my TestNG and no failure occures:*
>
>    *<test name="MockTest">
>      <class name="com.servepath.changerequest.ChangeRequestTest">
>        <test-method status="FAIL" signature="testError()" name="testError"
> duration-ms="375" started-at="2008-09-30T09:34:04Z"
> finished-at="2008-09-30T09:34:04Z">
>          <exception class="java.lang.AssertionError">
>            <message>
>              <![CDATA[Should have thrown a RuntimeCamelException]]>
>            </message>
>            <full-stacktrace>
>              <![CDATA[java.lang.AssertionError: Should have thrown a
> RuntimeCamelException
>    at org.testng.Assert.fail(Assert.java:84)
>    at
>
> com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:73)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
>    at
> org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
>    at
>
> org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at
> org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
>    at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
>    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
>    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
>    at
>
> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
>    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
>    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
>    at org.testng.TestRunner.privateRun(TestRunner.java:582)
>    at org.testng.TestRunner.run(TestRunner.java:477)
>    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
>    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
>    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
>    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
>    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
>    at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
>    at org.testng.TestNG.run(TestNG.java:708)
>    at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
>    at
>
> org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
>    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>    at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>    at java.lang.reflect.Method.invoke(Method.java:597)
>    at
>
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
>    at
>
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
> ]]>
>            </full-stacktrace>
> *
>
>
> *Here is the console trace for this test:
> *
> *tson/camel,route=[direct]start,type=route,name=[direct]start
> [myproject] DEBUG [main] DefaultCamelContext.addRoutes(341) | Adding routes
> from: Routes: [Route[ [From[direct:start]] -> [Interceptor[Delegate(Pipeli
>
> ne[DeadLetterChannel[Delegate(com.servepath.changerequest.ChangeRequestTest$1$1@188f506
> ),
> sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeli
> veries=1]], DeadLetterChannel[Delegate(sendTo(Endpoint[mock:result])),
> sendTo(Endpoint[mock:error]),
> RedeliveryPolicy[maximumRedeliveries=1]]])]]]]
> ro
> utes: []
> [myproject] DEBUG [main] ProducerCache.sendExchange(147) | >>>>
> Endpoint[direct:start] Exchange[Message: Boom]
> [myproject] ERROR [main] DeadLetterChannel.log(189) | Failed delivery for
> exchangeId: ID-mickknutson/2161-1222792429368/0-0. On delivery attempt: 0
> ca
> ught: java.lang.IllegalArgumentException: Forced exception by unit test
> java.lang.IllegalArgumentException: Forced exception by unit test
>        at
>
> com.servepath.changerequest.ChangeRequestTest$1$1.process(ChangeRequestTest.java:46)
>        at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
>        at
>
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
>        at
>
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
>        at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
>        at
>
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
>        at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
>        at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
>        at
>
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)
>        at
> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:149)
>        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:86)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:84)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:101)
>        at
>
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:107)
>        at
>
> com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:72)
> *
>
>
>
> On Mon, Sep 29, 2008 at 9:49 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi Mick
> >
> > Check out this unit test I just added:
> >
> > If you are using 1.5-SNAPSHOT remember that the producer template now
> > rethrows the exception that caused the failure in the routing. So you
> should
> > try .. catch this no. See the ErrorHandlerTest#testError() method.
> >
> > http://svn.apache.org/viewvc?view=rev&revision=700334
> >
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Claus Ibsen [mailto:ci@silverbullet.dk]
> > Sent: 30. september 2008 06:25
> > To: camel-user@activemq.apache.org
> > Subject: RE: issue routing Exchange to custom method in Processor
> >
> > Hi
> >
> > Could you put the error handler outside the from, so its like this:
> >
> > errorHandler(xxx);
> > from(yyy).process(zzz);
> >
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 30. september 2008 00:33
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I have looked through this whole thing, and there is nothing different
> than
> > what I am doing.
> >
> > My valid tests work fine. They get the expected messages and validate
> > accordingly. But the issue seems to be with processing deadLetter
> channels
> > in Mocks.
> >
> > So basically, in my test, the message is sent through to the
> > *resultEndpoint
> > *instead of the *resultErrorEndpoint *which is causing my test to fail.
> >
> >
> > Now just before I test my Mock's, I added this code to:
> >
> >        *Assert.assertNotNull(camelContext);
> >        Assert.assertNotNull(resultEndpoint);
> >        Assert.assertNotNull(resultErrorEndpoint);
> >
> >        //MockEndpoint.assertIsSatisfied(camelContext);
> >
> >        // lets show the endpoints in the test
> >        List<MockEndpoint> list =
> > CamelContextHelper.getSingletonEndpoints(camelContext,
> MockEndpoint.class);
> >        log.info("Found endpoints: " + list);
> >
> >        // lets dump the messages sent to our test endpoint
> >        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
> >        log.info
> >
> >
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> >        for (Exchange exchange : exchanges) {
> >            log.info("Received resultEndpoint: [" + exchange + "]\n");
> >        }
> >
> >        // lets dump the messages sent to our test endpoint
> >        List<Exchange> exchangesMock =
> > resultErrorEndpoint.getReceivedExchanges();
> >        log.info
> >
> >
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> >        for (Exchange exchange : exchangesMock) {
> >            log.info("Received resultErrorEndpoint: [" + exchange +
> "]\n");
> >        }
> >        log.info
> >
> >
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> > *
> >
> >
> > *And there is nothing happening to my error mock at all.*
> >
> >
> > *[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
> > testMocksAreValid
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
> > endpoints: [Endpoint[mock:outputDestinationURI],
> > Endpoint[mock:outputErrorDes
> > tinationURI]]
> > [myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
> > consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
> >
> >
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %%%%%%%%%%%
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) |
> Received
> > resultEndpoint: [Exchange[JmsMessage:
> {"changeRequestId":"99907","custId":
> > "70999","requestType":"provision","quota":"102400","backend":"
> > 192.168.0.0/16
> > ","password":"abcd1234"}]]
> >
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) |
> Received
> > resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
> > responseRequired = true, messageId =
> > ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
> > originalTransactionId = null, producerI
> > d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
> > queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
> > expiration = 0
> > , timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
> > brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
> > persisten
> > t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
> > targetConsumerId = null, compressed = false, userID = null, content =
> null,
> > ma
> > rshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> > size
> > = 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
> > , droppable = false, text =
> >
> >
> {"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]
> >
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
> >
> >
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %%%%%%%%%%%
> > [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
> >
> >
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %%%%%%%%%%%
> > *
> >
> > So there are 2 exchanges only. The first in green was for my initial add
> > request which was successful. The second for for my status update in
> > orange,
> > which was also successful.
> >
> > What I do NOT have is any exchange whatsoever for my failed request.
> >
> >
> >
> > So according to my <test name="*InvalidProvisionChangeRequest*">
> > *<message>
> > *
> > *              <![CDATA[mock:outputDestinationURI Received message
> > count. Expected:
> > <0> but was: <1>]]>
> >            </message>*
> >
> > Which means that nothing is getting routed to my deadLetter Channel in my
> > tests only.
> >
> >
> >
> >
> > On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > >
> > >
> >
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
> > >
> > > It is in fact not promoted too much (or not at all) on our camel wiki
> > > documentation.
> > >
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > >
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 19:57
> > > To: camel-user@activemq.apache.org
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > I deploy this as a war to Tomcat and use a single
> applicationContext.xml
> > to
> > > start camel like:
> > >
> > > *<import resource="classpath:META-INF/spring/camel-context.xml"/>
> > >
> > > <camelContext id="camel"
> > >                  xmlns="http://activemq.apache.org/camel/schema/spring
> ">
> > >        <!-- The routes are defined in -->
> > >        <package>com.servepath.gogrid.changerequest</package>
> > >
> > >    </camelContext>
> > > *
> > >
> > >
> > > The same as in my applicationContext-test.xml except I do not include
> any
> > > routing declarations as I have my test create the route like:
> > >
> > >
> > >    public void setRoutes(final String inputUri, final Processor
> > processor)
> > >            throws Exception {
> > >        // Add Routes to Camel Context
> > >        camelContext.addRoutes(new RouteBuilder() {
> > >            public void configure() {
> > >                from(inputUri)
> > >                        .errorHandler(
> > >
> > > deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
> > >
>  .loggingLevel(LoggingLevel.TRACE)
> > >
> > >                        )
> > >                        .process(changeRequestController)
> > >                        .to(MOCK_OUTPUT_DESTINATION_URI);
> > >            }
> > >        });
> > >
> > >    }//setRoutes
> > >
> > >
> > > PS, where can I find this camel TestNG component you are talking about?
> > >
> > >
> > >
> > >
> > >
> > > On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I think it could be how you start camel. When you deploy to Jetty do
> > you
> > > > deploy it as OSGi bundles, or as a web application?
> > > >
> > > > Either way then its usually Spring that is starting up as normal and
> it
> > > > will starup Camel properly.
> > > >
> > > > I am not sure this is happening correctly in your unit tests.
> > > >
> > > > Your BaseCamelTestNG class also starts Camel. It is only supposed to
> be
> > > > started once. As well as stopped, let Spring handle this.
> > > >
> > > > There must be a hook somewhere where you can add your routes. However
> > we
> > > > use either plain junit or spring junit based in the testing of camel
> > > itself
> > > > - not TestNG so I am afraid I have not used it that much.
> > > >
> > > > Could you check out the camel-testng component. It might have some
> > > pointers
> > > > there.
> > > >
> > > >
> > > > Med venlig hilsen
> > > >
> > > > Claus Ibsen
> > > > ......................................
> > > > Silverbullet
> > > > Skovsgårdsvænget 21
> > > > 8362 Hørning
> > > > Tlf. +45 2962 7576
> > > > Web: www.silverbullet.dk
> > > >
> > > > -----Original Message-----
> > > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > > Sent: 29. september 2008 19:26
> > > > To: camel-user@activemq.apache.org
> > > > Subject: Re: issue routing Exchange to custom method in Processor
> > > >
> > > > I have seperated them and that solves the first item. Thanks.
> > > > But I still can't seem to get my errorMock to work.
> > > >
> > > > But when I deploy this to Jetty, the route and errors act as
> expected.
> > > >
> > > >
> > > > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> > > wrote:
> > > >
> > > > > Hi
> > > > >
> > > > > I don't think you should have both @MessageDriven and Processor in
> > the
> > > > same
> > > > > java class. You should separate these two. This is not commonly
> used.
> > > > >
> > > > >
> > > > > Med venlig hilsen
> > > > >
> > > > > Claus Ibsen
> > > > > ......................................
> > > > > Silverbullet
> > > > > Skovsgårdsvænget 21
> > > > > 8362 Hørning
> > > > > Tlf. +45 2962 7576
> > > > > Web: www.silverbullet.dk
> > > > > -----Original Message-----
> > > > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > > > Sent: 29. september 2008 18:12
> > > > > To: Camel; Active MQ
> > > > > Subject: Re: issue routing Exchange to custom method in Processor
> > > > >
> > > > > Can someone help me?
> > > > >
> > > > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <
> > mknutson@baselogic.com
> > > > > >wrote:
> > > > >
> > > > > > The funny thing is, when I have an error with the message coming
> > from
> > > > > this
> > > > > > queue, which I do because process(Exchange) does not expect my
> > > message
> > > > > body,
> > > > > > the message gets routed to the proper deadLetter channel.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> > > mknutson@baselogic.com
> > > > > >wrote:
> > > > > >
> > > > > >> I have a Processor with 2 different methods:
> > > > > >>
> > > > > >> The standard:
> > > > > >> *public void process(Exchange exchange) {
> > > > > >> *
> > > > > >>
> > > > > >> and a custom:
> > > > > >>
> > > > > >>     *@MessageDriven(uri =
> Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > > >>     public void onMessage(Exchange exchange) *
> > > > > >>
> > > > > >> Now here is my route:
> > > > > >>
> > > > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > > > >>                 .errorHandler(
> > > > > >>
> > > > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > > > >> //.maximumRedeliveries(2)
> > > > > >>                                 //.initialRedeliveryDelay(1)
> > > > > >>
> .loggingLevel(LoggingLevel.DEBUG)
> > > > > >>                 ).processRef("changeRequestController")
> > > > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > > > >>
> > > > > >>
> > > > > >>         // Route for command status updates.
> > > > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > > >>                 .errorHandler(
> > > > > >>
> > > > > >>
> > > > >
> > > >
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > > > >>                                 .initialRedeliveryDelay(1)
> > > > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > > > >>
> > > > > ).to("bean:changeRequestController?methodName=onMessage");
> > > > > >> *
> > > > > >>
> > > > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > > > >> process(Exchange) method is called, and that rout is fine.
> > > > > >>
> > > > > >> However, I get a response message back on
> > > > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > > > >> but it is also processed by *the *process(Exchange) instead of
> my
> > > > > >> onMessage**(Exchange)*
> > > > > >>
> > > > > >> I have tried @MessageDriven annotation as well as the route
> > builder
> > > > but
> > > > > >> neither works.
> > > > > >>
> > > > > >> Am I forced to have each process in a single class?
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> --
> > > > > >> ---
> > > > > >> Thank You...
> > > > > >>
> > > > > >> Mick Knutson
> > > > > >> BASE Logic, inc.
> > > > > >> (415) 354-4215
> > > > > >>
> > > > > >> Website: http://baselogic.com
> > > > > >> Blog: http://baselogic.com/blog
> > > > > >> BLiNC Magazine: http://blincmagazine.com
> > > > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > > > >> DJ Mick: http://djmick.com
> > > > > >> MySpace: http://myspace.com/mickknutson
> > > > > >> Vacation Rental: http://tahoe.baselogic.com
> > > > > >>
> > > > > >>
> > > > > >
> > > > > >
> > > > > > --
> > > > > > ---
> > > > > > Thank You...
> > > > > >
> > > > > > Mick Knutson
> > > > > > BASE Logic, inc.
> > > > > > (415) 354-4215
> > > > > >
> > > > > > Website: http://baselogic.com
> > > > > > Blog: http://baselogic.com/blog
> > > > > > BLiNC Magazine: http://blincmagazine.com
> > > > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > > > DJ Mick: http://djmick.com
> > > > > > MySpace: http://myspace.com/mickknutson
> > > > > > Vacation Rental: http://tahoe.baselogic.com
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > ---
> > > > > Thank You...
> > > > >
> > > > > Mick Knutson
> > > > > BASE Logic, inc.
> > > > > (415) 354-4215
> > > > >
> > > > > Website: http://baselogic.com
> > > > > Blog: http://baselogic.com/blog
> > > > > BLiNC Magazine: http://blincmagazine.com
> > > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > > DJ Mick: http://djmick.com
> > > > > MySpace: http://myspace.com/mickknutson
> > > > > Vacation Rental: http://tahoe.baselogic.com
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Mick

What version are you using?

The unit test I created is with camel 1.5-SNAPSHOT.




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 30. september 2008 18:39
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

*I took the exact test method and create Route you had in that test:*


    *protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")

.errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(1))
                        .process(new Processor() {
                            public void process(Exchange exchange) throws
Exception {
                                String body =
exchange.getIn().getBody(String.class);
                                if ("Boom".equals(body)) {
                                    throw new
IllegalArgumentException("Forced exception by unit test");
                                }
                                exchange.getIn().setBody("Bye World");
                            }
                        })
                        .to("mock:result");
            }
        };
    }

    @Test(groups = {"functional"})
    public void testError() throws Exception {

        camelContext.addRoutes(createRouteBuilder());

        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        MockEndpoint error = getMockEndpoint("mock:error");
        MockEndpoint result = getMockEndpoint("mock:result");
        error.expectedMessageCount(1);
        result.expectedMessageCount(0);

        try {
            producerTemplate.sendBody("direct:start", "Boom");
            Assert.fail("Should have thrown a RuntimeCamelException");
        } catch (RuntimeCamelException e) {
            //assertIsInstanceOf(IllegalArgumentException.class,
e.getCause());
        }

        MockEndpoint.assertIsSatisfied(error, result);
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
    }
*






*And ran that in my TestNG and no failure occures:*

    *<test name="MockTest">
      <class name="com.servepath.changerequest.ChangeRequestTest">
        <test-method status="FAIL" signature="testError()" name="testError"
duration-ms="375" started-at="2008-09-30T09:34:04Z"
finished-at="2008-09-30T09:34:04Z">
          <exception class="java.lang.AssertionError">
            <message>
              <![CDATA[Should have thrown a RuntimeCamelException]]>
            </message>
            <full-stacktrace>
              <![CDATA[java.lang.AssertionError: Should have thrown a
RuntimeCamelException
    at org.testng.Assert.fail(Assert.java:84)
    at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
    at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
    at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
    at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
    at org.testng.TestRunner.privateRun(TestRunner.java:582)
    at org.testng.TestRunner.run(TestRunner.java:477)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
    at org.testng.TestNG.run(TestNG.java:708)
    at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
    at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
]]>
            </full-stacktrace>
*


*Here is the console trace for this test:
*
*tson/camel,route=[direct]start,type=route,name=[direct]start
[myproject] DEBUG [main] DefaultCamelContext.addRoutes(341) | Adding routes
from: Routes: [Route[ [From[direct:start]] -> [Interceptor[Delegate(Pipeli
ne[DeadLetterChannel[Delegate(com.servepath.changerequest.ChangeRequestTest$1$1@188f506),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeli
veries=1]], DeadLetterChannel[Delegate(sendTo(Endpoint[mock:result])),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeliveries=1]]])]]]]
ro
utes: []
[myproject] DEBUG [main] ProducerCache.sendExchange(147) | >>>>
Endpoint[direct:start] Exchange[Message: Boom]
[myproject] ERROR [main] DeadLetterChannel.log(189) | Failed delivery for
exchangeId: ID-mickknutson/2161-1222792429368/0-0. On delivery attempt: 0 ca
ught: java.lang.IllegalArgumentException: Forced exception by unit test
java.lang.IllegalArgumentException: Forced exception by unit test
        at
com.servepath.changerequest.ChangeRequestTest$1$1.process(ChangeRequestTest.java:46)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
        at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)
        at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:149)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:86)
        at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:84)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:101)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:107)
        at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:72)
*



On Mon, Sep 29, 2008 at 9:49 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi Mick
>
> Check out this unit test I just added:
>
> If you are using 1.5-SNAPSHOT remember that the producer template now
> rethrows the exception that caused the failure in the routing. So you should
> try .. catch this no. See the ErrorHandlerTest#testError() method.
>
> http://svn.apache.org/viewvc?view=rev&revision=700334
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Claus Ibsen [mailto:ci@silverbullet.dk]
> Sent: 30. september 2008 06:25
> To: camel-user@activemq.apache.org
> Subject: RE: issue routing Exchange to custom method in Processor
>
> Hi
>
> Could you put the error handler outside the from, so its like this:
>
> errorHandler(xxx);
> from(yyy).process(zzz);
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 30. september 2008 00:33
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I have looked through this whole thing, and there is nothing different than
> what I am doing.
>
> My valid tests work fine. They get the expected messages and validate
> accordingly. But the issue seems to be with processing deadLetter channels
> in Mocks.
>
> So basically, in my test, the message is sent through to the
> *resultEndpoint
> *instead of the *resultErrorEndpoint *which is causing my test to fail.
>
>
> Now just before I test my Mock's, I added this code to:
>
>        *Assert.assertNotNull(camelContext);
>        Assert.assertNotNull(resultEndpoint);
>        Assert.assertNotNull(resultErrorEndpoint);
>
>        //MockEndpoint.assertIsSatisfied(camelContext);
>
>        // lets show the endpoints in the test
>        List<MockEndpoint> list =
> CamelContextHelper.getSingletonEndpoints(camelContext, MockEndpoint.class);
>        log.info("Found endpoints: " + list);
>
>        // lets dump the messages sent to our test endpoint
>        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
>        log.info
>
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
>        for (Exchange exchange : exchanges) {
>            log.info("Received resultEndpoint: [" + exchange + "]\n");
>        }
>
>        // lets dump the messages sent to our test endpoint
>        List<Exchange> exchangesMock =
> resultErrorEndpoint.getReceivedExchanges();
>        log.info
>
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
>        for (Exchange exchange : exchangesMock) {
>            log.info("Received resultErrorEndpoint: [" + exchange + "]\n");
>        }
>        log.info
>
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> *
>
>
> *And there is nothing happening to my error mock at all.*
>
>
> *[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
> testMocksAreValid
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
> endpoints: [Endpoint[mock:outputDestinationURI],
> Endpoint[mock:outputErrorDes
> tinationURI]]
> [myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
> consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%%%
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
> resultEndpoint: [Exchange[JmsMessage: {"changeRequestId":"99907","custId":
> "70999","requestType":"provision","quota":"102400","backend":"
> 192.168.0.0/16
> ","password":"abcd1234"}]]
>
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
> resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
> responseRequired = true, messageId =
> ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
> originalTransactionId = null, producerI
> d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
> queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
> expiration = 0
> , timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
> brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
> persisten
> t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
> targetConsumerId = null, compressed = false, userID = null, content = null,
> ma
> rshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> size
> = 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
> , droppable = false, text =
>
> {"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]
>
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%%%
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%%%
> *
>
> So there are 2 exchanges only. The first in green was for my initial add
> request which was successful. The second for for my status update in
> orange,
> which was also successful.
>
> What I do NOT have is any exchange whatsoever for my failed request.
>
>
>
> So according to my <test name="*InvalidProvisionChangeRequest*">
> *<message>
> *
> *              <![CDATA[mock:outputDestinationURI Received message
> count. Expected:
> <0> but was: <1>]]>
>            </message>*
>
> Which means that nothing is getting routed to my deadLetter Channel in my
> tests only.
>
>
>
>
> On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> >
> >
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
> >
> > It is in fact not promoted too much (or not at all) on our camel wiki
> > documentation.
> >
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 19:57
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I deploy this as a war to Tomcat and use a single applicationContext.xml
> to
> > start camel like:
> >
> > *<import resource="classpath:META-INF/spring/camel-context.xml"/>
> >
> > <camelContext id="camel"
> >                  xmlns="http://activemq.apache.org/camel/schema/spring">
> >        <!-- The routes are defined in -->
> >        <package>com.servepath.gogrid.changerequest</package>
> >
> >    </camelContext>
> > *
> >
> >
> > The same as in my applicationContext-test.xml except I do not include any
> > routing declarations as I have my test create the route like:
> >
> >
> >    public void setRoutes(final String inputUri, final Processor
> processor)
> >            throws Exception {
> >        // Add Routes to Camel Context
> >        camelContext.addRoutes(new RouteBuilder() {
> >            public void configure() {
> >                from(inputUri)
> >                        .errorHandler(
> >
> > deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
> >                                        .loggingLevel(LoggingLevel.TRACE)
> >
> >                        )
> >                        .process(changeRequestController)
> >                        .to(MOCK_OUTPUT_DESTINATION_URI);
> >            }
> >        });
> >
> >    }//setRoutes
> >
> >
> > PS, where can I find this camel TestNG component you are talking about?
> >
> >
> >
> >
> >
> > On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > > Hi
> > >
> > > I think it could be how you start camel. When you deploy to Jetty do
> you
> > > deploy it as OSGi bundles, or as a web application?
> > >
> > > Either way then its usually Spring that is starting up as normal and it
> > > will starup Camel properly.
> > >
> > > I am not sure this is happening correctly in your unit tests.
> > >
> > > Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> > > started once. As well as stopped, let Spring handle this.
> > >
> > > There must be a hook somewhere where you can add your routes. However
> we
> > > use either plain junit or spring junit based in the testing of camel
> > itself
> > > - not TestNG so I am afraid I have not used it that much.
> > >
> > > Could you check out the camel-testng component. It might have some
> > pointers
> > > there.
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > >
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 19:26
> > > To: camel-user@activemq.apache.org
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > I have seperated them and that solves the first item. Thanks.
> > > But I still can't seem to get my errorMock to work.
> > >
> > > But when I deploy this to Jetty, the route and errors act as expected.
> > >
> > >
> > > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I don't think you should have both @MessageDriven and Processor in
> the
> > > same
> > > > java class. You should separate these two. This is not commonly used.
> > > >
> > > >
> > > > Med venlig hilsen
> > > >
> > > > Claus Ibsen
> > > > ......................................
> > > > Silverbullet
> > > > Skovsgårdsvænget 21
> > > > 8362 Hørning
> > > > Tlf. +45 2962 7576
> > > > Web: www.silverbullet.dk
> > > > -----Original Message-----
> > > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > > Sent: 29. september 2008 18:12
> > > > To: Camel; Active MQ
> > > > Subject: Re: issue routing Exchange to custom method in Processor
> > > >
> > > > Can someone help me?
> > > >
> > > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <
> mknutson@baselogic.com
> > > > >wrote:
> > > >
> > > > > The funny thing is, when I have an error with the message coming
> from
> > > > this
> > > > > queue, which I do because process(Exchange) does not expect my
> > message
> > > > body,
> > > > > the message gets routed to the proper deadLetter channel.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> > mknutson@baselogic.com
> > > > >wrote:
> > > > >
> > > > >> I have a Processor with 2 different methods:
> > > > >>
> > > > >> The standard:
> > > > >> *public void process(Exchange exchange) {
> > > > >> *
> > > > >>
> > > > >> and a custom:
> > > > >>
> > > > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > >>     public void onMessage(Exchange exchange) *
> > > > >>
> > > > >> Now here is my route:
> > > > >>
> > > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > > >>                 .errorHandler(
> > > > >>
> > > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > > >> //.maximumRedeliveries(2)
> > > > >>                                 //.initialRedeliveryDelay(1)
> > > > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > > > >>                 ).processRef("changeRequestController")
> > > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > > >>
> > > > >>
> > > > >>         // Route for command status updates.
> > > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > >>                 .errorHandler(
> > > > >>
> > > > >>
> > > >
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > > >>                                 .initialRedeliveryDelay(1)
> > > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > > >>
> > > > ).to("bean:changeRequestController?methodName=onMessage");
> > > > >> *
> > > > >>
> > > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > > >> process(Exchange) method is called, and that rout is fine.
> > > > >>
> > > > >> However, I get a response message back on
> > > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > > >> but it is also processed by *the *process(Exchange) instead of my
> > > > >> onMessage**(Exchange)*
> > > > >>
> > > > >> I have tried @MessageDriven annotation as well as the route
> builder
> > > but
> > > > >> neither works.
> > > > >>
> > > > >> Am I forced to have each process in a single class?
> > > > >>
> > > > >>
> > > > >>
> > > > >> --
> > > > >> ---
> > > > >> Thank You...
> > > > >>
> > > > >> Mick Knutson
> > > > >> BASE Logic, inc.
> > > > >> (415) 354-4215
> > > > >>
> > > > >> Website: http://baselogic.com
> > > > >> Blog: http://baselogic.com/blog
> > > > >> BLiNC Magazine: http://blincmagazine.com
> > > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > > >> DJ Mick: http://djmick.com
> > > > >> MySpace: http://myspace.com/mickknutson
> > > > >> Vacation Rental: http://tahoe.baselogic.com
> > > > >>
> > > > >>
> > > > >
> > > > >
> > > > > --
> > > > > ---
> > > > > Thank You...
> > > > >
> > > > > Mick Knutson
> > > > > BASE Logic, inc.
> > > > > (415) 354-4215
> > > > >
> > > > > Website: http://baselogic.com
> > > > > Blog: http://baselogic.com/blog
> > > > > BLiNC Magazine: http://blincmagazine.com
> > > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > > DJ Mick: http://djmick.com
> > > > > MySpace: http://myspace.com/mickknutson
> > > > > Vacation Rental: http://tahoe.baselogic.com
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
*I took the exact test method and create Route you had in that test:*


    *protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")

.errorHandler(deadLetterChannel("mock:error").maximumRedeliveries(1))
                        .process(new Processor() {
                            public void process(Exchange exchange) throws
Exception {
                                String body =
exchange.getIn().getBody(String.class);
                                if ("Boom".equals(body)) {
                                    throw new
IllegalArgumentException("Forced exception by unit test");
                                }
                                exchange.getIn().setBody("Bye World");
                            }
                        })
                        .to("mock:result");
            }
        };
    }

    @Test(groups = {"functional"})
    public void testError() throws Exception {

        camelContext.addRoutes(createRouteBuilder());

        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        MockEndpoint error = getMockEndpoint("mock:error");
        MockEndpoint result = getMockEndpoint("mock:result");
        error.expectedMessageCount(1);
        result.expectedMessageCount(0);

        try {
            producerTemplate.sendBody("direct:start", "Boom");
            Assert.fail("Should have thrown a RuntimeCamelException");
        } catch (RuntimeCamelException e) {
            //assertIsInstanceOf(IllegalArgumentException.class,
e.getCause());
        }

        MockEndpoint.assertIsSatisfied(error, result);
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
        log.debug("----------------------------------------------------");
    }
*






*And ran that in my TestNG and no failure occures:*

    *<test name="MockTest">
      <class name="com.servepath.changerequest.ChangeRequestTest">
        <test-method status="FAIL" signature="testError()" name="testError"
duration-ms="375" started-at="2008-09-30T09:34:04Z"
finished-at="2008-09-30T09:34:04Z">
          <exception class="java.lang.AssertionError">
            <message>
              <![CDATA[Should have thrown a RuntimeCamelException]]>
            </message>
            <full-stacktrace>
              <![CDATA[java.lang.AssertionError: Should have thrown a
RuntimeCamelException
    at org.testng.Assert.fail(Assert.java:84)
    at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
    at
org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:698)
    at
org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:706)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:468)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
    at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
    at org.testng.TestRunner.runWorkers(TestRunner.java:712)
    at org.testng.TestRunner.privateRun(TestRunner.java:582)
    at org.testng.TestRunner.run(TestRunner.java:477)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
    at org.testng.SuiteRunner.run(SuiteRunner.java:198)
    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
    at org.testng.TestNG.run(TestNG.java:708)
    at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
    at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
]]>
            </full-stacktrace>
*


*Here is the console trace for this test:
*
*tson/camel,route=[direct]start,type=route,name=[direct]start
[myproject] DEBUG [main] DefaultCamelContext.addRoutes(341) | Adding routes
from: Routes: [Route[ [From[direct:start]] -> [Interceptor[Delegate(Pipeli
ne[DeadLetterChannel[Delegate(com.servepath.changerequest.ChangeRequestTest$1$1@188f506),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeli
veries=1]], DeadLetterChannel[Delegate(sendTo(Endpoint[mock:result])),
sendTo(Endpoint[mock:error]), RedeliveryPolicy[maximumRedeliveries=1]]])]]]]
ro
utes: []
[myproject] DEBUG [main] ProducerCache.sendExchange(147) | >>>>
Endpoint[direct:start] Exchange[Message: Boom]
[myproject] ERROR [main] DeadLetterChannel.log(189) | Failed delivery for
exchangeId: ID-mickknutson/2161-1222792429368/0-0. On delivery attempt: 0 ca
ught: java.lang.IllegalArgumentException: Forced exception by unit test
java.lang.IllegalArgumentException: Forced exception by unit test
        at
com.servepath.changerequest.ChangeRequestTest$1$1.process(ChangeRequestTest.java:46)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
        at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
        at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:47)
        at
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:149)
        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:86)
        at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:84)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:101)
        at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:107)
        at
com.servepath.changerequest.ChangeRequestTest.testError(ChangeRequestTest.java:72)
*



On Mon, Sep 29, 2008 at 9:49 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi Mick
>
> Check out this unit test I just added:
>
> If you are using 1.5-SNAPSHOT remember that the producer template now
> rethrows the exception that caused the failure in the routing. So you should
> try .. catch this no. See the ErrorHandlerTest#testError() method.
>
> http://svn.apache.org/viewvc?view=rev&revision=700334
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Claus Ibsen [mailto:ci@silverbullet.dk]
> Sent: 30. september 2008 06:25
> To: camel-user@activemq.apache.org
> Subject: RE: issue routing Exchange to custom method in Processor
>
> Hi
>
> Could you put the error handler outside the from, so its like this:
>
> errorHandler(xxx);
> from(yyy).process(zzz);
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 30. september 2008 00:33
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I have looked through this whole thing, and there is nothing different than
> what I am doing.
>
> My valid tests work fine. They get the expected messages and validate
> accordingly. But the issue seems to be with processing deadLetter channels
> in Mocks.
>
> So basically, in my test, the message is sent through to the
> *resultEndpoint
> *instead of the *resultErrorEndpoint *which is causing my test to fail.
>
>
> Now just before I test my Mock's, I added this code to:
>
>        *Assert.assertNotNull(camelContext);
>        Assert.assertNotNull(resultEndpoint);
>        Assert.assertNotNull(resultErrorEndpoint);
>
>        //MockEndpoint.assertIsSatisfied(camelContext);
>
>        // lets show the endpoints in the test
>        List<MockEndpoint> list =
> CamelContextHelper.getSingletonEndpoints(camelContext, MockEndpoint.class);
>        log.info("Found endpoints: " + list);
>
>        // lets dump the messages sent to our test endpoint
>        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
>        log.info
>
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
>        for (Exchange exchange : exchanges) {
>            log.info("Received resultEndpoint: [" + exchange + "]\n");
>        }
>
>        // lets dump the messages sent to our test endpoint
>        List<Exchange> exchangesMock =
> resultErrorEndpoint.getReceivedExchanges();
>        log.info
>
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
>        for (Exchange exchange : exchangesMock) {
>            log.info("Received resultErrorEndpoint: [" + exchange + "]\n");
>        }
>        log.info
>
> ("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
> *
>
>
> *And there is nothing happening to my error mock at all.*
>
>
> *[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
> testMocksAreValid
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
> endpoints: [Endpoint[mock:outputDestinationURI],
> Endpoint[mock:outputErrorDes
> tinationURI]]
> [myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
> consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%%%
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
> resultEndpoint: [Exchange[JmsMessage: {"changeRequestId":"99907","custId":
> "70999","requestType":"provision","quota":"102400","backend":"
> 192.168.0.0/16
> ","password":"abcd1234"}]]
>
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
> resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
> responseRequired = true, messageId =
> ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
> originalTransactionId = null, producerI
> d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
> queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
> expiration = 0
> , timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
> brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
> persisten
> t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
> targetConsumerId = null, compressed = false, userID = null, content = null,
> ma
> rshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> size
> = 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
> , droppable = false, text =
>
> {"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]
>
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%%%
> [myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %%%%%%%%%%%
> *
>
> So there are 2 exchanges only. The first in green was for my initial add
> request which was successful. The second for for my status update in
> orange,
> which was also successful.
>
> What I do NOT have is any exchange whatsoever for my failed request.
>
>
>
> So according to my <test name="*InvalidProvisionChangeRequest*">
> *<message>
> *
> *              <![CDATA[mock:outputDestinationURI Received message
> count. Expected:
> <0> but was: <1>]]>
>            </message>*
>
> Which means that nothing is getting routed to my deadLetter Channel in my
> tests only.
>
>
>
>
> On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> >
> >
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
> >
> > It is in fact not promoted too much (or not at all) on our camel wiki
> > documentation.
> >
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 19:57
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I deploy this as a war to Tomcat and use a single applicationContext.xml
> to
> > start camel like:
> >
> > *<import resource="classpath:META-INF/spring/camel-context.xml"/>
> >
> > <camelContext id="camel"
> >                  xmlns="http://activemq.apache.org/camel/schema/spring">
> >        <!-- The routes are defined in -->
> >        <package>com.servepath.gogrid.changerequest</package>
> >
> >    </camelContext>
> > *
> >
> >
> > The same as in my applicationContext-test.xml except I do not include any
> > routing declarations as I have my test create the route like:
> >
> >
> >    public void setRoutes(final String inputUri, final Processor
> processor)
> >            throws Exception {
> >        // Add Routes to Camel Context
> >        camelContext.addRoutes(new RouteBuilder() {
> >            public void configure() {
> >                from(inputUri)
> >                        .errorHandler(
> >
> > deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
> >                                        .loggingLevel(LoggingLevel.TRACE)
> >
> >                        )
> >                        .process(changeRequestController)
> >                        .to(MOCK_OUTPUT_DESTINATION_URI);
> >            }
> >        });
> >
> >    }//setRoutes
> >
> >
> > PS, where can I find this camel TestNG component you are talking about?
> >
> >
> >
> >
> >
> > On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > > Hi
> > >
> > > I think it could be how you start camel. When you deploy to Jetty do
> you
> > > deploy it as OSGi bundles, or as a web application?
> > >
> > > Either way then its usually Spring that is starting up as normal and it
> > > will starup Camel properly.
> > >
> > > I am not sure this is happening correctly in your unit tests.
> > >
> > > Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> > > started once. As well as stopped, let Spring handle this.
> > >
> > > There must be a hook somewhere where you can add your routes. However
> we
> > > use either plain junit or spring junit based in the testing of camel
> > itself
> > > - not TestNG so I am afraid I have not used it that much.
> > >
> > > Could you check out the camel-testng component. It might have some
> > pointers
> > > there.
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > >
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 19:26
> > > To: camel-user@activemq.apache.org
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > I have seperated them and that solves the first item. Thanks.
> > > But I still can't seem to get my errorMock to work.
> > >
> > > But when I deploy this to Jetty, the route and errors act as expected.
> > >
> > >
> > > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> > wrote:
> > >
> > > > Hi
> > > >
> > > > I don't think you should have both @MessageDriven and Processor in
> the
> > > same
> > > > java class. You should separate these two. This is not commonly used.
> > > >
> > > >
> > > > Med venlig hilsen
> > > >
> > > > Claus Ibsen
> > > > ......................................
> > > > Silverbullet
> > > > Skovsgårdsvænget 21
> > > > 8362 Hørning
> > > > Tlf. +45 2962 7576
> > > > Web: www.silverbullet.dk
> > > > -----Original Message-----
> > > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > > Sent: 29. september 2008 18:12
> > > > To: Camel; Active MQ
> > > > Subject: Re: issue routing Exchange to custom method in Processor
> > > >
> > > > Can someone help me?
> > > >
> > > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <
> mknutson@baselogic.com
> > > > >wrote:
> > > >
> > > > > The funny thing is, when I have an error with the message coming
> from
> > > > this
> > > > > queue, which I do because process(Exchange) does not expect my
> > message
> > > > body,
> > > > > the message gets routed to the proper deadLetter channel.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> > mknutson@baselogic.com
> > > > >wrote:
> > > > >
> > > > >> I have a Processor with 2 different methods:
> > > > >>
> > > > >> The standard:
> > > > >> *public void process(Exchange exchange) {
> > > > >> *
> > > > >>
> > > > >> and a custom:
> > > > >>
> > > > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > >>     public void onMessage(Exchange exchange) *
> > > > >>
> > > > >> Now here is my route:
> > > > >>
> > > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > > >>                 .errorHandler(
> > > > >>
> > > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > > >> //.maximumRedeliveries(2)
> > > > >>                                 //.initialRedeliveryDelay(1)
> > > > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > > > >>                 ).processRef("changeRequestController")
> > > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > > >>
> > > > >>
> > > > >>         // Route for command status updates.
> > > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > > >>                 .errorHandler(
> > > > >>
> > > > >>
> > > >
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > > >>                                 .initialRedeliveryDelay(1)
> > > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > > >>
> > > > ).to("bean:changeRequestController?methodName=onMessage");
> > > > >> *
> > > > >>
> > > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > > >> process(Exchange) method is called, and that rout is fine.
> > > > >>
> > > > >> However, I get a response message back on
> > > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > > >> but it is also processed by *the *process(Exchange) instead of my
> > > > >> onMessage**(Exchange)*
> > > > >>
> > > > >> I have tried @MessageDriven annotation as well as the route
> builder
> > > but
> > > > >> neither works.
> > > > >>
> > > > >> Am I forced to have each process in a single class?
> > > > >>
> > > > >>
> > > > >>
> > > > >> --
> > > > >> ---
> > > > >> Thank You...
> > > > >>
> > > > >> Mick Knutson
> > > > >> BASE Logic, inc.
> > > > >> (415) 354-4215
> > > > >>
> > > > >> Website: http://baselogic.com
> > > > >> Blog: http://baselogic.com/blog
> > > > >> BLiNC Magazine: http://blincmagazine.com
> > > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > > >> DJ Mick: http://djmick.com
> > > > >> MySpace: http://myspace.com/mickknutson
> > > > >> Vacation Rental: http://tahoe.baselogic.com
> > > > >>
> > > > >>
> > > > >
> > > > >
> > > > > --
> > > > > ---
> > > > > Thank You...
> > > > >
> > > > > Mick Knutson
> > > > > BASE Logic, inc.
> > > > > (415) 354-4215
> > > > >
> > > > > Website: http://baselogic.com
> > > > > Blog: http://baselogic.com/blog
> > > > > BLiNC Magazine: http://blincmagazine.com
> > > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > > DJ Mick: http://djmick.com
> > > > > MySpace: http://myspace.com/mickknutson
> > > > > Vacation Rental: http://tahoe.baselogic.com
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Mick

Check out this unit test I just added:

If you are using 1.5-SNAPSHOT remember that the producer template now rethrows the exception that caused the failure in the routing. So you should try .. catch this no. See the ErrorHandlerTest#testError() method.

http://svn.apache.org/viewvc?view=rev&revision=700334



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Claus Ibsen [mailto:ci@silverbullet.dk] 
Sent: 30. september 2008 06:25
To: camel-user@activemq.apache.org
Subject: RE: issue routing Exchange to custom method in Processor

Hi

Could you put the error handler outside the from, so its like this:

errorHandler(xxx);
from(yyy).process(zzz);



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 30. september 2008 00:33
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

I have looked through this whole thing, and there is nothing different than
what I am doing.

My valid tests work fine. They get the expected messages and validate
accordingly. But the issue seems to be with processing deadLetter channels
in Mocks.

So basically, in my test, the message is sent through to the *resultEndpoint
*instead of the *resultErrorEndpoint *which is causing my test to fail.


Now just before I test my Mock's, I added this code to:

        *Assert.assertNotNull(camelContext);
        Assert.assertNotNull(resultEndpoint);
        Assert.assertNotNull(resultErrorEndpoint);

        //MockEndpoint.assertIsSatisfied(camelContext);

        // lets show the endpoints in the test
        List<MockEndpoint> list =
CamelContextHelper.getSingletonEndpoints(camelContext, MockEndpoint.class);
        log.info("Found endpoints: " + list);

        // lets dump the messages sent to our test endpoint
        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        for (Exchange exchange : exchanges) {
            log.info("Received resultEndpoint: [" + exchange + "]\n");
        }

        // lets dump the messages sent to our test endpoint
        List<Exchange> exchangesMock =
resultErrorEndpoint.getReceivedExchanges();
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        for (Exchange exchange : exchangesMock) {
            log.info("Received resultErrorEndpoint: [" + exchange + "]\n");
        }
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
*


*And there is nothing happening to my error mock at all.*


*[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
testMocksAreValid
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
endpoints: [Endpoint[mock:outputDestinationURI],
Endpoint[mock:outputErrorDes
tinationURI]]
[myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
resultEndpoint: [Exchange[JmsMessage: {"changeRequestId":"99907","custId":
"70999","requestType":"provision","quota":"102400","backend":"192.168.0.0/16
","password":"abcd1234"}]]

[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
responseRequired = true, messageId =
ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
originalTransactionId = null, producerI
d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
expiration = 0
, timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
persisten
t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content = null,
ma
rshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size
= 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
, droppable = false, text =
{"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]

[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
*

So there are 2 exchanges only. The first in green was for my initial add
request which was successful. The second for for my status update in orange,
which was also successful.

What I do NOT have is any exchange whatsoever for my failed request.



So according to my <test name="*InvalidProvisionChangeRequest*">
*<message>
*
*              <![CDATA[mock:outputDestinationURI Received message
count. Expected:
<0> but was: <1>]]>
            </message>*

Which means that nothing is getting routed to my deadLetter Channel in my
tests only.




On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

>
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
>
> It is in fact not promoted too much (or not at all) on our camel wiki
> documentation.
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 19:57
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I deploy this as a war to Tomcat and use a single applicationContext.xml to
> start camel like:
>
> *<import resource="classpath:META-INF/spring/camel-context.xml"/>
>
> <camelContext id="camel"
>                  xmlns="http://activemq.apache.org/camel/schema/spring">
>        <!-- The routes are defined in -->
>        <package>com.servepath.gogrid.changerequest</package>
>
>    </camelContext>
> *
>
>
> The same as in my applicationContext-test.xml except I do not include any
> routing declarations as I have my test create the route like:
>
>
>    public void setRoutes(final String inputUri, final Processor processor)
>            throws Exception {
>        // Add Routes to Camel Context
>        camelContext.addRoutes(new RouteBuilder() {
>            public void configure() {
>                from(inputUri)
>                        .errorHandler(
>
> deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
>                                        .loggingLevel(LoggingLevel.TRACE)
>
>                        )
>                        .process(changeRequestController)
>                        .to(MOCK_OUTPUT_DESTINATION_URI);
>            }
>        });
>
>    }//setRoutes
>
>
> PS, where can I find this camel TestNG component you are talking about?
>
>
>
>
>
> On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi
> >
> > I think it could be how you start camel. When you deploy to Jetty do you
> > deploy it as OSGi bundles, or as a web application?
> >
> > Either way then its usually Spring that is starting up as normal and it
> > will starup Camel properly.
> >
> > I am not sure this is happening correctly in your unit tests.
> >
> > Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> > started once. As well as stopped, let Spring handle this.
> >
> > There must be a hook somewhere where you can add your routes. However we
> > use either plain junit or spring junit based in the testing of camel
> itself
> > - not TestNG so I am afraid I have not used it that much.
> >
> > Could you check out the camel-testng component. It might have some
> pointers
> > there.
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 19:26
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I have seperated them and that solves the first item. Thanks.
> > But I still can't seem to get my errorMock to work.
> >
> > But when I deploy this to Jetty, the route and errors act as expected.
> >
> >
> > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > > Hi
> > >
> > > I don't think you should have both @MessageDriven and Processor in the
> > same
> > > java class. You should separate these two. This is not commonly used.
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 18:12
> > > To: Camel; Active MQ
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > Can someone help me?
> > >
> > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> > > >wrote:
> > >
> > > > The funny thing is, when I have an error with the message coming from
> > > this
> > > > queue, which I do because process(Exchange) does not expect my
> message
> > > body,
> > > > the message gets routed to the proper deadLetter channel.
> > > >
> > > >
> > > >
> > > >
> > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> mknutson@baselogic.com
> > > >wrote:
> > > >
> > > >> I have a Processor with 2 different methods:
> > > >>
> > > >> The standard:
> > > >> *public void process(Exchange exchange) {
> > > >> *
> > > >>
> > > >> and a custom:
> > > >>
> > > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > >>     public void onMessage(Exchange exchange) *
> > > >>
> > > >> Now here is my route:
> > > >>
> > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > >>                 .errorHandler(
> > > >>
> > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > >> //.maximumRedeliveries(2)
> > > >>                                 //.initialRedeliveryDelay(1)
> > > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > > >>                 ).processRef("changeRequestController")
> > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > >>
> > > >>
> > > >>         // Route for command status updates.
> > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > >>                 .errorHandler(
> > > >>
> > > >>
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > >>                                 .initialRedeliveryDelay(1)
> > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > >>
> > > ).to("bean:changeRequestController?methodName=onMessage");
> > > >> *
> > > >>
> > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > >> process(Exchange) method is called, and that rout is fine.
> > > >>
> > > >> However, I get a response message back on
> > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > >> but it is also processed by *the *process(Exchange) instead of my
> > > >> onMessage**(Exchange)*
> > > >>
> > > >> I have tried @MessageDriven annotation as well as the route builder
> > but
> > > >> neither works.
> > > >>
> > > >> Am I forced to have each process in a single class?
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> ---
> > > >> Thank You...
> > > >>
> > > >> Mick Knutson
> > > >> BASE Logic, inc.
> > > >> (415) 354-4215
> > > >>
> > > >> Website: http://baselogic.com
> > > >> Blog: http://baselogic.com/blog
> > > >> BLiNC Magazine: http://blincmagazine.com
> > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > >> DJ Mick: http://djmick.com
> > > >> MySpace: http://myspace.com/mickknutson
> > > >> Vacation Rental: http://tahoe.baselogic.com
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Could you put the error handler outside the from, so its like this:

errorHandler(xxx);
from(yyy).process(zzz);



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 30. september 2008 00:33
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

I have looked through this whole thing, and there is nothing different than
what I am doing.

My valid tests work fine. They get the expected messages and validate
accordingly. But the issue seems to be with processing deadLetter channels
in Mocks.

So basically, in my test, the message is sent through to the *resultEndpoint
*instead of the *resultErrorEndpoint *which is causing my test to fail.


Now just before I test my Mock's, I added this code to:

        *Assert.assertNotNull(camelContext);
        Assert.assertNotNull(resultEndpoint);
        Assert.assertNotNull(resultErrorEndpoint);

        //MockEndpoint.assertIsSatisfied(camelContext);

        // lets show the endpoints in the test
        List<MockEndpoint> list =
CamelContextHelper.getSingletonEndpoints(camelContext, MockEndpoint.class);
        log.info("Found endpoints: " + list);

        // lets dump the messages sent to our test endpoint
        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        for (Exchange exchange : exchanges) {
            log.info("Received resultEndpoint: [" + exchange + "]\n");
        }

        // lets dump the messages sent to our test endpoint
        List<Exchange> exchangesMock =
resultErrorEndpoint.getReceivedExchanges();
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        for (Exchange exchange : exchangesMock) {
            log.info("Received resultErrorEndpoint: [" + exchange + "]\n");
        }
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
*


*And there is nothing happening to my error mock at all.*


*[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
testMocksAreValid
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
endpoints: [Endpoint[mock:outputDestinationURI],
Endpoint[mock:outputErrorDes
tinationURI]]
[myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
resultEndpoint: [Exchange[JmsMessage: {"changeRequestId":"99907","custId":
"70999","requestType":"provision","quota":"102400","backend":"192.168.0.0/16
","password":"abcd1234"}]]

[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
responseRequired = true, messageId =
ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
originalTransactionId = null, producerI
d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
expiration = 0
, timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
persisten
t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content = null,
ma
rshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size
= 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
, droppable = false, text =
{"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]

[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
*

So there are 2 exchanges only. The first in green was for my initial add
request which was successful. The second for for my status update in orange,
which was also successful.

What I do NOT have is any exchange whatsoever for my failed request.



So according to my <test name="*InvalidProvisionChangeRequest*">
*<message>
*
*              <![CDATA[mock:outputDestinationURI Received message
count. Expected:
<0> but was: <1>]]>
            </message>*

Which means that nothing is getting routed to my deadLetter Channel in my
tests only.




On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

>
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
>
> It is in fact not promoted too much (or not at all) on our camel wiki
> documentation.
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 19:57
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I deploy this as a war to Tomcat and use a single applicationContext.xml to
> start camel like:
>
> *<import resource="classpath:META-INF/spring/camel-context.xml"/>
>
> <camelContext id="camel"
>                  xmlns="http://activemq.apache.org/camel/schema/spring">
>        <!-- The routes are defined in -->
>        <package>com.servepath.gogrid.changerequest</package>
>
>    </camelContext>
> *
>
>
> The same as in my applicationContext-test.xml except I do not include any
> routing declarations as I have my test create the route like:
>
>
>    public void setRoutes(final String inputUri, final Processor processor)
>            throws Exception {
>        // Add Routes to Camel Context
>        camelContext.addRoutes(new RouteBuilder() {
>            public void configure() {
>                from(inputUri)
>                        .errorHandler(
>
> deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
>                                        .loggingLevel(LoggingLevel.TRACE)
>
>                        )
>                        .process(changeRequestController)
>                        .to(MOCK_OUTPUT_DESTINATION_URI);
>            }
>        });
>
>    }//setRoutes
>
>
> PS, where can I find this camel TestNG component you are talking about?
>
>
>
>
>
> On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi
> >
> > I think it could be how you start camel. When you deploy to Jetty do you
> > deploy it as OSGi bundles, or as a web application?
> >
> > Either way then its usually Spring that is starting up as normal and it
> > will starup Camel properly.
> >
> > I am not sure this is happening correctly in your unit tests.
> >
> > Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> > started once. As well as stopped, let Spring handle this.
> >
> > There must be a hook somewhere where you can add your routes. However we
> > use either plain junit or spring junit based in the testing of camel
> itself
> > - not TestNG so I am afraid I have not used it that much.
> >
> > Could you check out the camel-testng component. It might have some
> pointers
> > there.
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 19:26
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I have seperated them and that solves the first item. Thanks.
> > But I still can't seem to get my errorMock to work.
> >
> > But when I deploy this to Jetty, the route and errors act as expected.
> >
> >
> > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > > Hi
> > >
> > > I don't think you should have both @MessageDriven and Processor in the
> > same
> > > java class. You should separate these two. This is not commonly used.
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 18:12
> > > To: Camel; Active MQ
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > Can someone help me?
> > >
> > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> > > >wrote:
> > >
> > > > The funny thing is, when I have an error with the message coming from
> > > this
> > > > queue, which I do because process(Exchange) does not expect my
> message
> > > body,
> > > > the message gets routed to the proper deadLetter channel.
> > > >
> > > >
> > > >
> > > >
> > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> mknutson@baselogic.com
> > > >wrote:
> > > >
> > > >> I have a Processor with 2 different methods:
> > > >>
> > > >> The standard:
> > > >> *public void process(Exchange exchange) {
> > > >> *
> > > >>
> > > >> and a custom:
> > > >>
> > > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > >>     public void onMessage(Exchange exchange) *
> > > >>
> > > >> Now here is my route:
> > > >>
> > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > >>                 .errorHandler(
> > > >>
> > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > >> //.maximumRedeliveries(2)
> > > >>                                 //.initialRedeliveryDelay(1)
> > > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > > >>                 ).processRef("changeRequestController")
> > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > >>
> > > >>
> > > >>         // Route for command status updates.
> > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > >>                 .errorHandler(
> > > >>
> > > >>
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > >>                                 .initialRedeliveryDelay(1)
> > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > >>
> > > ).to("bean:changeRequestController?methodName=onMessage");
> > > >> *
> > > >>
> > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > >> process(Exchange) method is called, and that rout is fine.
> > > >>
> > > >> However, I get a response message back on
> > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > >> but it is also processed by *the *process(Exchange) instead of my
> > > >> onMessage**(Exchange)*
> > > >>
> > > >> I have tried @MessageDriven annotation as well as the route builder
> > but
> > > >> neither works.
> > > >>
> > > >> Am I forced to have each process in a single class?
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> ---
> > > >> Thank You...
> > > >>
> > > >> Mick Knutson
> > > >> BASE Logic, inc.
> > > >> (415) 354-4215
> > > >>
> > > >> Website: http://baselogic.com
> > > >> Blog: http://baselogic.com/blog
> > > >> BLiNC Magazine: http://blincmagazine.com
> > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > >> DJ Mick: http://djmick.com
> > > >> MySpace: http://myspace.com/mickknutson
> > > >> Vacation Rental: http://tahoe.baselogic.com
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
I have looked through this whole thing, and there is nothing different than
what I am doing.

My valid tests work fine. They get the expected messages and validate
accordingly. But the issue seems to be with processing deadLetter channels
in Mocks.

So basically, in my test, the message is sent through to the *resultEndpoint
*instead of the *resultErrorEndpoint *which is causing my test to fail.


Now just before I test my Mock's, I added this code to:

        *Assert.assertNotNull(camelContext);
        Assert.assertNotNull(resultEndpoint);
        Assert.assertNotNull(resultErrorEndpoint);

        //MockEndpoint.assertIsSatisfied(camelContext);

        // lets show the endpoints in the test
        List<MockEndpoint> list =
CamelContextHelper.getSingletonEndpoints(camelContext, MockEndpoint.class);
        log.info("Found endpoints: " + list);

        // lets dump the messages sent to our test endpoint
        List<Exchange> exchanges = resultEndpoint.getReceivedExchanges();
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        for (Exchange exchange : exchanges) {
            log.info("Received resultEndpoint: [" + exchange + "]\n");
        }

        // lets dump the messages sent to our test endpoint
        List<Exchange> exchangesMock =
resultErrorEndpoint.getReceivedExchanges();
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        for (Exchange exchange : exchangesMock) {
            log.info("Received resultErrorEndpoint: [" + exchange + "]\n");
        }
        log.info
("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
*


*And there is nothing happening to my error mock at all.*


*[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(152) |
testMocksAreValid
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(162) | Found
endpoints: [Endpoint[mock:outputDestinationURI],
Endpoint[mock:outputErrorDes
tinationURI]]
[myproject] DEBUG [VMTransport] AbstractRegion.addConsumer(215) | Adding
consumer: ID:mickknutson-3837-1222725262920-2:21:1:1
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(166) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
resultEndpoint: [Exchange[JmsMessage: {"changeRequestId":"99907","custId":
"70999","requestType":"provision","quota":"102400","backend":"192.168.0.0/16
","password":"abcd1234"}]]

[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(168) | Received
resultEndpoint: [Exchange[JmsMessage: ActiveMQTextMessage {commandId = 5,
responseRequired = true, messageId =
ID:mickknutson-3837-1222725262920-2:12:1:1:1, originalDestination = null,
originalTransactionId = null, producerI
d = ID:mickknutson-3837-1222725262920-2:12:1:1, destination =
queue://channel/gogrid/cloudstorage/command/status, transactionId = null,
expiration = 0
, timestamp = 1222725273779, arrival = 0, brokerInTime = 1222725273779,
brokerOutTime = 1222725273779, correlationId = null, replyTo = null,
persisten
t = true, type = null, priority = 4, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content = null,
ma
rshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size
= 1024, properties = null, readOnlyProperties = true, readOnlyBody = true
, droppable = false, text =
{"commandType":"jobCreated","changeRequestId":"1234567890","timeout":0,"jobId":"bdceca38-8bba-11dd-b4f0-0030488bd1fd"}}]]

[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(173) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
[myproject] INFO [main] ChangeRequestTest.testMocksAreValid(177) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%
*

So there are 2 exchanges only. The first in green was for my initial add
request which was successful. The second for for my status update in orange,
which was also successful.

What I do NOT have is any exchange whatsoever for my failed request.



So according to my <test name="*InvalidProvisionChangeRequest*">
*<message>
*
*              <![CDATA[mock:outputDestinationURI Received message
count. Expected:
<0> but was: <1>]]>
            </message>*

Which means that nothing is getting routed to my deadLetter Channel in my
tests only.




On Mon, Sep 29, 2008 at 11:21 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

>
> https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/
>
> It is in fact not promoted too much (or not at all) on our camel wiki
> documentation.
>
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 19:57
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I deploy this as a war to Tomcat and use a single applicationContext.xml to
> start camel like:
>
> *<import resource="classpath:META-INF/spring/camel-context.xml"/>
>
> <camelContext id="camel"
>                  xmlns="http://activemq.apache.org/camel/schema/spring">
>        <!-- The routes are defined in -->
>        <package>com.servepath.gogrid.changerequest</package>
>
>    </camelContext>
> *
>
>
> The same as in my applicationContext-test.xml except I do not include any
> routing declarations as I have my test create the route like:
>
>
>    public void setRoutes(final String inputUri, final Processor processor)
>            throws Exception {
>        // Add Routes to Camel Context
>        camelContext.addRoutes(new RouteBuilder() {
>            public void configure() {
>                from(inputUri)
>                        .errorHandler(
>
> deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
>                                        .loggingLevel(LoggingLevel.TRACE)
>
>                        )
>                        .process(changeRequestController)
>                        .to(MOCK_OUTPUT_DESTINATION_URI);
>            }
>        });
>
>    }//setRoutes
>
>
> PS, where can I find this camel TestNG component you are talking about?
>
>
>
>
>
> On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi
> >
> > I think it could be how you start camel. When you deploy to Jetty do you
> > deploy it as OSGi bundles, or as a web application?
> >
> > Either way then its usually Spring that is starting up as normal and it
> > will starup Camel properly.
> >
> > I am not sure this is happening correctly in your unit tests.
> >
> > Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> > started once. As well as stopped, let Spring handle this.
> >
> > There must be a hook somewhere where you can add your routes. However we
> > use either plain junit or spring junit based in the testing of camel
> itself
> > - not TestNG so I am afraid I have not used it that much.
> >
> > Could you check out the camel-testng component. It might have some
> pointers
> > there.
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> >
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 19:26
> > To: camel-user@activemq.apache.org
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > I have seperated them and that solves the first item. Thanks.
> > But I still can't seem to get my errorMock to work.
> >
> > But when I deploy this to Jetty, the route and errors act as expected.
> >
> >
> > On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk>
> wrote:
> >
> > > Hi
> > >
> > > I don't think you should have both @MessageDriven and Processor in the
> > same
> > > java class. You should separate these two. This is not commonly used.
> > >
> > >
> > > Med venlig hilsen
> > >
> > > Claus Ibsen
> > > ......................................
> > > Silverbullet
> > > Skovsgårdsvænget 21
> > > 8362 Hørning
> > > Tlf. +45 2962 7576
> > > Web: www.silverbullet.dk
> > > -----Original Message-----
> > > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > > Sent: 29. september 2008 18:12
> > > To: Camel; Active MQ
> > > Subject: Re: issue routing Exchange to custom method in Processor
> > >
> > > Can someone help me?
> > >
> > > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> > > >wrote:
> > >
> > > > The funny thing is, when I have an error with the message coming from
> > > this
> > > > queue, which I do because process(Exchange) does not expect my
> message
> > > body,
> > > > the message gets routed to the proper deadLetter channel.
> > > >
> > > >
> > > >
> > > >
> > > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <
> mknutson@baselogic.com
> > > >wrote:
> > > >
> > > >> I have a Processor with 2 different methods:
> > > >>
> > > >> The standard:
> > > >> *public void process(Exchange exchange) {
> > > >> *
> > > >>
> > > >> and a custom:
> > > >>
> > > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > >>     public void onMessage(Exchange exchange) *
> > > >>
> > > >> Now here is my route:
> > > >>
> > > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > > >>                 .errorHandler(
> > > >>
> > > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > > >> //.maximumRedeliveries(2)
> > > >>                                 //.initialRedeliveryDelay(1)
> > > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > > >>                 ).processRef("changeRequestController")
> > > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > > >>
> > > >>
> > > >>         // Route for command status updates.
> > > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > > >>                 .errorHandler(
> > > >>
> > > >>
> > >
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > > >>                                 .initialRedeliveryDelay(1)
> > > >>                                 .loggingLevel(LoggingLevel.INFO)
> > > >>
> > > ).to("bean:changeRequestController?methodName=onMessage");
> > > >> *
> > > >>
> > > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > > >> process(Exchange) method is called, and that rout is fine.
> > > >>
> > > >> However, I get a response message back on
> > > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > > >> but it is also processed by *the *process(Exchange) instead of my
> > > >> onMessage**(Exchange)*
> > > >>
> > > >> I have tried @MessageDriven annotation as well as the route builder
> > but
> > > >> neither works.
> > > >>
> > > >> Am I forced to have each process in a single class?
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> ---
> > > >> Thank You...
> > > >>
> > > >> Mick Knutson
> > > >> BASE Logic, inc.
> > > >> (415) 354-4215
> > > >>
> > > >> Website: http://baselogic.com
> > > >> Blog: http://baselogic.com/blog
> > > >> BLiNC Magazine: http://blincmagazine.com
> > > >> Linked IN: http://linkedin.com/in/mickknutson
> > > >> DJ Mick: http://djmick.com
> > > >> MySpace: http://myspace.com/mickknutson
> > > >> Vacation Rental: http://tahoe.baselogic.com
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > ---
> > > > Thank You...
> > > >
> > > > Mick Knutson
> > > > BASE Logic, inc.
> > > > (415) 354-4215
> > > >
> > > > Website: http://baselogic.com
> > > > Blog: http://baselogic.com/blog
> > > > BLiNC Magazine: http://blincmagazine.com
> > > > Linked IN: http://linkedin.com/in/mickknutson
> > > > DJ Mick: http://djmick.com
> > > > MySpace: http://myspace.com/mickknutson
> > > > Vacation Rental: http://tahoe.baselogic.com
> > > >
> > > >
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-testng/

It is in fact not promoted too much (or not at all) on our camel wiki documentation.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 29. september 2008 19:57
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

I deploy this as a war to Tomcat and use a single applicationContext.xml to
start camel like:

*<import resource="classpath:META-INF/spring/camel-context.xml"/>

<camelContext id="camel"
                  xmlns="http://activemq.apache.org/camel/schema/spring">
        <!-- The routes are defined in -->
        <package>com.servepath.gogrid.changerequest</package>

    </camelContext>
*


The same as in my applicationContext-test.xml except I do not include any
routing declarations as I have my test create the route like:


    public void setRoutes(final String inputUri, final Processor processor)
            throws Exception {
        // Add Routes to Camel Context
        camelContext.addRoutes(new RouteBuilder() {
            public void configure() {
                from(inputUri)
                        .errorHandler(

deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
                                        .loggingLevel(LoggingLevel.TRACE)

                        )
                        .process(changeRequestController)
                        .to(MOCK_OUTPUT_DESTINATION_URI);
            }
        });

    }//setRoutes


PS, where can I find this camel TestNG component you are talking about?





On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi
>
> I think it could be how you start camel. When you deploy to Jetty do you
> deploy it as OSGi bundles, or as a web application?
>
> Either way then its usually Spring that is starting up as normal and it
> will starup Camel properly.
>
> I am not sure this is happening correctly in your unit tests.
>
> Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> started once. As well as stopped, let Spring handle this.
>
> There must be a hook somewhere where you can add your routes. However we
> use either plain junit or spring junit based in the testing of camel itself
> - not TestNG so I am afraid I have not used it that much.
>
> Could you check out the camel-testng component. It might have some pointers
> there.
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 19:26
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I have seperated them and that solves the first item. Thanks.
> But I still can't seem to get my errorMock to work.
>
> But when I deploy this to Jetty, the route and errors act as expected.
>
>
> On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi
> >
> > I don't think you should have both @MessageDriven and Processor in the
> same
> > java class. You should separate these two. This is not commonly used.
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 18:12
> > To: Camel; Active MQ
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > Can someone help me?
> >
> > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> > >wrote:
> >
> > > The funny thing is, when I have an error with the message coming from
> > this
> > > queue, which I do because process(Exchange) does not expect my message
> > body,
> > > the message gets routed to the proper deadLetter channel.
> > >
> > >
> > >
> > >
> > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mknutson@baselogic.com
> > >wrote:
> > >
> > >> I have a Processor with 2 different methods:
> > >>
> > >> The standard:
> > >> *public void process(Exchange exchange) {
> > >> *
> > >>
> > >> and a custom:
> > >>
> > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > >>     public void onMessage(Exchange exchange) *
> > >>
> > >> Now here is my route:
> > >>
> > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > >>                 .errorHandler(
> > >>
> > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > >> //.maximumRedeliveries(2)
> > >>                                 //.initialRedeliveryDelay(1)
> > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > >>                 ).processRef("changeRequestController")
> > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > >>
> > >>
> > >>         // Route for command status updates.
> > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > >>                 .errorHandler(
> > >>
> > >>
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > >>                                 .initialRedeliveryDelay(1)
> > >>                                 .loggingLevel(LoggingLevel.INFO)
> > >>
> > ).to("bean:changeRequestController?methodName=onMessage");
> > >> *
> > >>
> > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > >> process(Exchange) method is called, and that rout is fine.
> > >>
> > >> However, I get a response message back on
> > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > >> but it is also processed by *the *process(Exchange) instead of my
> > >> onMessage**(Exchange)*
> > >>
> > >> I have tried @MessageDriven annotation as well as the route builder
> but
> > >> neither works.
> > >>
> > >> Am I forced to have each process in a single class?
> > >>
> > >>
> > >>
> > >> --
> > >> ---
> > >> Thank You...
> > >>
> > >> Mick Knutson
> > >> BASE Logic, inc.
> > >> (415) 354-4215
> > >>
> > >> Website: http://baselogic.com
> > >> Blog: http://baselogic.com/blog
> > >> BLiNC Magazine: http://blincmagazine.com
> > >> Linked IN: http://linkedin.com/in/mickknutson
> > >> DJ Mick: http://djmick.com
> > >> MySpace: http://myspace.com/mickknutson
> > >> Vacation Rental: http://tahoe.baselogic.com
> > >>
> > >>
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> > >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
I deploy this as a war to Tomcat and use a single applicationContext.xml to
start camel like:

*<import resource="classpath:META-INF/spring/camel-context.xml"/>

<camelContext id="camel"
                  xmlns="http://activemq.apache.org/camel/schema/spring">
        <!-- The routes are defined in -->
        <package>com.servepath.gogrid.changerequest</package>

    </camelContext>
*


The same as in my applicationContext-test.xml except I do not include any
routing declarations as I have my test create the route like:


    public void setRoutes(final String inputUri, final Processor processor)
            throws Exception {
        // Add Routes to Camel Context
        camelContext.addRoutes(new RouteBuilder() {
            public void configure() {
                from(inputUri)
                        .errorHandler(

deadLetterChannel(MOCK_OUTPUT_DESTINATION_URI)
                                        .loggingLevel(LoggingLevel.TRACE)

                        )
                        .process(changeRequestController)
                        .to(MOCK_OUTPUT_DESTINATION_URI);
            }
        });

    }//setRoutes


PS, where can I find this camel TestNG component you are talking about?





On Mon, Sep 29, 2008 at 10:34 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi
>
> I think it could be how you start camel. When you deploy to Jetty do you
> deploy it as OSGi bundles, or as a web application?
>
> Either way then its usually Spring that is starting up as normal and it
> will starup Camel properly.
>
> I am not sure this is happening correctly in your unit tests.
>
> Your BaseCamelTestNG class also starts Camel. It is only supposed to be
> started once. As well as stopped, let Spring handle this.
>
> There must be a hook somewhere where you can add your routes. However we
> use either plain junit or spring junit based in the testing of camel itself
> - not TestNG so I am afraid I have not used it that much.
>
> Could you check out the camel-testng component. It might have some pointers
> there.
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
>
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 19:26
> To: camel-user@activemq.apache.org
> Subject: Re: issue routing Exchange to custom method in Processor
>
> I have seperated them and that solves the first item. Thanks.
> But I still can't seem to get my errorMock to work.
>
> But when I deploy this to Jetty, the route and errors act as expected.
>
>
> On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>
> > Hi
> >
> > I don't think you should have both @MessageDriven and Processor in the
> same
> > java class. You should separate these two. This is not commonly used.
> >
> >
> > Med venlig hilsen
> >
> > Claus Ibsen
> > ......................................
> > Silverbullet
> > Skovsgårdsvænget 21
> > 8362 Hørning
> > Tlf. +45 2962 7576
> > Web: www.silverbullet.dk
> > -----Original Message-----
> > From: Mick Knutson [mailto:mknutson@baselogic.com]
> > Sent: 29. september 2008 18:12
> > To: Camel; Active MQ
> > Subject: Re: issue routing Exchange to custom method in Processor
> >
> > Can someone help me?
> >
> > On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> > >wrote:
> >
> > > The funny thing is, when I have an error with the message coming from
> > this
> > > queue, which I do because process(Exchange) does not expect my message
> > body,
> > > the message gets routed to the proper deadLetter channel.
> > >
> > >
> > >
> > >
> > > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mknutson@baselogic.com
> > >wrote:
> > >
> > >> I have a Processor with 2 different methods:
> > >>
> > >> The standard:
> > >> *public void process(Exchange exchange) {
> > >> *
> > >>
> > >> and a custom:
> > >>
> > >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > >>     public void onMessage(Exchange exchange) *
> > >>
> > >> Now here is my route:
> > >>
> > >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> > >>                 .errorHandler(
> > >>
> > >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> > >> //.maximumRedeliveries(2)
> > >>                                 //.initialRedeliveryDelay(1)
> > >>                                 .loggingLevel(LoggingLevel.DEBUG)
> > >>                 ).processRef("changeRequestController")
> > >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> > >>
> > >>
> > >>         // Route for command status updates.
> > >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> > >>                 .errorHandler(
> > >>
> > >>
> >
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> > >>                                 .initialRedeliveryDelay(1)
> > >>                                 .loggingLevel(LoggingLevel.INFO)
> > >>
> > ).to("bean:changeRequestController?methodName=onMessage");
> > >> *
> > >>
> > >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> > >> process(Exchange) method is called, and that rout is fine.
> > >>
> > >> However, I get a response message back on
> > **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> > >> but it is also processed by *the *process(Exchange) instead of my
> > >> onMessage**(Exchange)*
> > >>
> > >> I have tried @MessageDriven annotation as well as the route builder
> but
> > >> neither works.
> > >>
> > >> Am I forced to have each process in a single class?
> > >>
> > >>
> > >>
> > >> --
> > >> ---
> > >> Thank You...
> > >>
> > >> Mick Knutson
> > >> BASE Logic, inc.
> > >> (415) 354-4215
> > >>
> > >> Website: http://baselogic.com
> > >> Blog: http://baselogic.com/blog
> > >> BLiNC Magazine: http://blincmagazine.com
> > >> Linked IN: http://linkedin.com/in/mickknutson
> > >> DJ Mick: http://djmick.com
> > >> MySpace: http://myspace.com/mickknutson
> > >> Vacation Rental: http://tahoe.baselogic.com
> > >>
> > >>
> > >
> > >
> > > --
> > > ---
> > > Thank You...
> > >
> > > Mick Knutson
> > > BASE Logic, inc.
> > > (415) 354-4215
> > >
> > > Website: http://baselogic.com
> > > Blog: http://baselogic.com/blog
> > > BLiNC Magazine: http://blincmagazine.com
> > > Linked IN: http://linkedin.com/in/mickknutson
> > > DJ Mick: http://djmick.com
> > > MySpace: http://myspace.com/mickknutson
> > > Vacation Rental: http://tahoe.baselogic.com
> > >
> > >
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

I think it could be how you start camel. When you deploy to Jetty do you deploy it as OSGi bundles, or as a web application?

Either way then its usually Spring that is starting up as normal and it will starup Camel properly.

I am not sure this is happening correctly in your unit tests.

Your BaseCamelTestNG class also starts Camel. It is only supposed to be started once. As well as stopped, let Spring handle this.

There must be a hook somewhere where you can add your routes. However we use either plain junit or spring junit based in the testing of camel itself - not TestNG so I am afraid I have not used it that much.

Could you check out the camel-testng component. It might have some pointers there.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 29. september 2008 19:26
To: camel-user@activemq.apache.org
Subject: Re: issue routing Exchange to custom method in Processor

I have seperated them and that solves the first item. Thanks.
But I still can't seem to get my errorMock to work.

But when I deploy this to Jetty, the route and errors act as expected.


On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi
>
> I don't think you should have both @MessageDriven and Processor in the same
> java class. You should separate these two. This is not commonly used.
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 18:12
> To: Camel; Active MQ
> Subject: Re: issue routing Exchange to custom method in Processor
>
> Can someone help me?
>
> On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> >wrote:
>
> > The funny thing is, when I have an error with the message coming from
> this
> > queue, which I do because process(Exchange) does not expect my message
> body,
> > the message gets routed to the proper deadLetter channel.
> >
> >
> >
> >
> > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mknutson@baselogic.com
> >wrote:
> >
> >> I have a Processor with 2 different methods:
> >>
> >> The standard:
> >> *public void process(Exchange exchange) {
> >> *
> >>
> >> and a custom:
> >>
> >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> >>     public void onMessage(Exchange exchange) *
> >>
> >> Now here is my route:
> >>
> >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> >>                 .errorHandler(
> >>
> >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> >> //.maximumRedeliveries(2)
> >>                                 //.initialRedeliveryDelay(1)
> >>                                 .loggingLevel(LoggingLevel.DEBUG)
> >>                 ).processRef("changeRequestController")
> >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> >>
> >>
> >>         // Route for command status updates.
> >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> >>                 .errorHandler(
> >>
> >>
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> >>                                 .initialRedeliveryDelay(1)
> >>                                 .loggingLevel(LoggingLevel.INFO)
> >>
> ).to("bean:changeRequestController?methodName=onMessage");
> >> *
> >>
> >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> >> process(Exchange) method is called, and that rout is fine.
> >>
> >> However, I get a response message back on
> **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> >> but it is also processed by *the *process(Exchange) instead of my
> >> onMessage**(Exchange)*
> >>
> >> I have tried @MessageDriven annotation as well as the route builder but
> >> neither works.
> >>
> >> Am I forced to have each process in a single class?
> >>
> >>
> >>
> >> --
> >> ---
> >> Thank You...
> >>
> >> Mick Knutson
> >> BASE Logic, inc.
> >> (415) 354-4215
> >>
> >> Website: http://baselogic.com
> >> Blog: http://baselogic.com/blog
> >> BLiNC Magazine: http://blincmagazine.com
> >> Linked IN: http://linkedin.com/in/mickknutson
> >> DJ Mick: http://djmick.com
> >> MySpace: http://myspace.com/mickknutson
> >> Vacation Rental: http://tahoe.baselogic.com
> >>
> >>
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
> >
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
I have seperated them and that solves the first item. Thanks.
But I still can't seem to get my errorMock to work.

But when I deploy this to Jetty, the route and errors act as expected.


On Mon, Sep 29, 2008 at 10:22 AM, Claus Ibsen <ci...@silverbullet.dk> wrote:

> Hi
>
> I don't think you should have both @MessageDriven and Processor in the same
> java class. You should separate these two. This is not commonly used.
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: 29. september 2008 18:12
> To: Camel; Active MQ
> Subject: Re: issue routing Exchange to custom method in Processor
>
> Can someone help me?
>
> On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mknutson@baselogic.com
> >wrote:
>
> > The funny thing is, when I have an error with the message coming from
> this
> > queue, which I do because process(Exchange) does not expect my message
> body,
> > the message gets routed to the proper deadLetter channel.
> >
> >
> >
> >
> > On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mknutson@baselogic.com
> >wrote:
> >
> >> I have a Processor with 2 different methods:
> >>
> >> The standard:
> >> *public void process(Exchange exchange) {
> >> *
> >>
> >> and a custom:
> >>
> >>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> >>     public void onMessage(Exchange exchange) *
> >>
> >> Now here is my route:
> >>
> >>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
> >>                 .errorHandler(
> >>
> >> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> >> //.maximumRedeliveries(2)
> >>                                 //.initialRedeliveryDelay(1)
> >>                                 .loggingLevel(LoggingLevel.DEBUG)
> >>                 ).processRef("changeRequestController")
> >>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
> >>
> >>
> >>         // Route for command status updates.
> >>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
> >>                 .errorHandler(
> >>
> >>
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
> >>                                 .initialRedeliveryDelay(1)
> >>                                 .loggingLevel(LoggingLevel.INFO)
> >>
> ).to("bean:changeRequestController?methodName=onMessage");
> >> *
> >>
> >> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> >> process(Exchange) method is called, and that rout is fine.
> >>
> >> However, I get a response message back on
> **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> >> but it is also processed by *the *process(Exchange) instead of my
> >> onMessage**(Exchange)*
> >>
> >> I have tried @MessageDriven annotation as well as the route builder but
> >> neither works.
> >>
> >> Am I forced to have each process in a single class?
> >>
> >>
> >>
> >> --
> >> ---
> >> Thank You...
> >>
> >> Mick Knutson
> >> BASE Logic, inc.
> >> (415) 354-4215
> >>
> >> Website: http://baselogic.com
> >> Blog: http://baselogic.com/blog
> >> BLiNC Magazine: http://blincmagazine.com
> >> Linked IN: http://linkedin.com/in/mickknutson
> >> DJ Mick: http://djmick.com
> >> MySpace: http://myspace.com/mickknutson
> >> Vacation Rental: http://tahoe.baselogic.com
> >>
> >>
> >
> >
> > --
> > ---
> > Thank You...
> >
> > Mick Knutson
> > BASE Logic, inc.
> > (415) 354-4215
> >
> > Website: http://baselogic.com
> > Blog: http://baselogic.com/blog
> > BLiNC Magazine: http://blincmagazine.com
> > Linked IN: http://linkedin.com/in/mickknutson
> > DJ Mick: http://djmick.com
> > MySpace: http://myspace.com/mickknutson
> > Vacation Rental: http://tahoe.baselogic.com
> >
> >
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>



-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

RE: issue routing Exchange to custom method in Processor

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

I don't think you should have both @MessageDriven and Processor in the same java class. You should separate these two. This is not commonly used.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com] 
Sent: 29. september 2008 18:12
To: Camel; Active MQ
Subject: Re: issue routing Exchange to custom method in Processor

Can someone help me?

On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mk...@baselogic.com>wrote:

> The funny thing is, when I have an error with the message coming from this
> queue, which I do because process(Exchange) does not expect my message body,
> the message gets routed to the proper deadLetter channel.
>
>
>
>
> On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mk...@baselogic.com>wrote:
>
>> I have a Processor with 2 different methods:
>>
>> The standard:
>> *public void process(Exchange exchange) {
>> *
>>
>> and a custom:
>>
>>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>>     public void onMessage(Exchange exchange) *
>>
>> Now here is my route:
>>
>>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
>>                 .errorHandler(
>>
>> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
>> //.maximumRedeliveries(2)
>>                                 //.initialRedeliveryDelay(1)
>>                                 .loggingLevel(LoggingLevel.DEBUG)
>>                 ).processRef("changeRequestController")
>>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
>>
>>
>>         // Route for command status updates.
>>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>>                 .errorHandler(
>>
>> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
>>                                 .initialRedeliveryDelay(1)
>>                                 .loggingLevel(LoggingLevel.INFO)
>>                 ).to("bean:changeRequestController?methodName=onMessage");
>> *
>>
>> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
>> process(Exchange) method is called, and that rout is fine.
>>
>> However, I get a response message back on **Constants.CHANNEL_GG_CS_COMMAND_STATUS
>> but it is also processed by *the *process(Exchange) instead of my
>> onMessage**(Exchange)*
>>
>> I have tried @MessageDriven annotation as well as the route builder but
>> neither works.
>>
>> Am I forced to have each process in a single class?
>>
>>
>>
>> --
>> ---
>> Thank You...
>>
>> Mick Knutson
>> BASE Logic, inc.
>> (415) 354-4215
>>
>> Website: http://baselogic.com
>> Blog: http://baselogic.com/blog
>> BLiNC Magazine: http://blincmagazine.com
>> Linked IN: http://linkedin.com/in/mickknutson
>> DJ Mick: http://djmick.com
>> MySpace: http://myspace.com/mickknutson
>> Vacation Rental: http://tahoe.baselogic.com
>>
>>
>
>
> --
> ---
> Thank You...
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>
>


-- 
---
Thank You...

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
Can someone help me?

On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mk...@baselogic.com>wrote:

> The funny thing is, when I have an error with the message coming from this
> queue, which I do because process(Exchange) does not expect my message body,
> the message gets routed to the proper deadLetter channel.
>
>
>
>
> On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mk...@baselogic.com>wrote:
>
>> I have a Processor with 2 different methods:
>>
>> The standard:
>> *public void process(Exchange exchange) {
>> *
>>
>> and a custom:
>>
>>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>>     public void onMessage(Exchange exchange) *
>>
>> Now here is my route:
>>
>>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
>>                 .errorHandler(
>>
>> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
>> //.maximumRedeliveries(2)
>>                                 //.initialRedeliveryDelay(1)
>>                                 .loggingLevel(LoggingLevel.DEBUG)
>>                 ).processRef("changeRequestController")
>>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
>>
>>
>>         // Route for command status updates.
>>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>>                 .errorHandler(
>>
>> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
>>                                 .initialRedeliveryDelay(1)
>>                                 .loggingLevel(LoggingLevel.INFO)
>>                 ).to("bean:changeRequestController?methodName=onMessage");
>> *
>>
>> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
>> process(Exchange) method is called, and that rout is fine.
>>
>> However, I get a response message back on **Constants.CHANNEL_GG_CS_COMMAND_STATUS
>> but it is also processed by *the *process(Exchange) instead of my
>> onMessage**(Exchange)*
>>
>> I have tried @MessageDriven annotation as well as the route builder but
>> neither works.
>>
>> Am I forced to have each process in a single class?
>>
>>
>>
>> --
>> ---
>> Thank You…
>>
>> Mick Knutson
>> BASE Logic, inc.
>> (415) 354-4215
>>
>> Website: http://baselogic.com
>> Blog: http://baselogic.com/blog
>> BLiNC Magazine: http://blincmagazine.com
>> Linked IN: http://linkedin.com/in/mickknutson
>> DJ Mick: http://djmick.com
>> MySpace: http://myspace.com/mickknutson
>> Vacation Rental: http://tahoe.baselogic.com
>>
>>
>
>
> --
> ---
> Thank You…
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>
>


-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
Can someone help me?

On Fri, Sep 26, 2008 at 3:10 PM, Mick Knutson <mk...@baselogic.com>wrote:

> The funny thing is, when I have an error with the message coming from this
> queue, which I do because process(Exchange) does not expect my message body,
> the message gets routed to the proper deadLetter channel.
>
>
>
>
> On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mk...@baselogic.com>wrote:
>
>> I have a Processor with 2 different methods:
>>
>> The standard:
>> *public void process(Exchange exchange) {
>> *
>>
>> and a custom:
>>
>>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>>     public void onMessage(Exchange exchange) *
>>
>> Now here is my route:
>>
>>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
>>                 .errorHandler(
>>
>> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
>> //.maximumRedeliveries(2)
>>                                 //.initialRedeliveryDelay(1)
>>                                 .loggingLevel(LoggingLevel.DEBUG)
>>                 ).processRef("changeRequestController")
>>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
>>
>>
>>         // Route for command status updates.
>>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>>                 .errorHandler(
>>
>> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
>>                                 .initialRedeliveryDelay(1)
>>                                 .loggingLevel(LoggingLevel.INFO)
>>                 ).to("bean:changeRequestController?methodName=onMessage");
>> *
>>
>> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
>> process(Exchange) method is called, and that rout is fine.
>>
>> However, I get a response message back on **Constants.CHANNEL_GG_CS_COMMAND_STATUS
>> but it is also processed by *the *process(Exchange) instead of my
>> onMessage**(Exchange)*
>>
>> I have tried @MessageDriven annotation as well as the route builder but
>> neither works.
>>
>> Am I forced to have each process in a single class?
>>
>>
>>
>> --
>> ---
>> Thank You…
>>
>> Mick Knutson
>> BASE Logic, inc.
>> (415) 354-4215
>>
>> Website: http://baselogic.com
>> Blog: http://baselogic.com/blog
>> BLiNC Magazine: http://blincmagazine.com
>> Linked IN: http://linkedin.com/in/mickknutson
>> DJ Mick: http://djmick.com
>> MySpace: http://myspace.com/mickknutson
>> Vacation Rental: http://tahoe.baselogic.com
>>
>>
>
>
> --
> ---
> Thank You…
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>
>


-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com

Re: issue routing Exchange to custom method in Processor

Posted by Mick Knutson <mk...@baselogic.com>.
The funny thing is, when I have an error with the message coming from this
queue, which I do because process(Exchange) does not expect my message body,
the message gets routed to the proper deadLetter channel.



On Fri, Sep 26, 2008 at 12:22 PM, Mick Knutson <mk...@baselogic.com>wrote:

> I have a Processor with 2 different methods:
>
> The standard:
> *public void process(Exchange exchange) {
> *
>
> and a custom:
>
>     *@MessageDriven(uri = Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>     public void onMessage(Exchange exchange) *
>
> Now here is my route:
>
>        * from(Constants.CHANNEL_GG_CS_CR_ADD)
>                 .errorHandler(
>
> deadLetterChannel(Constants.CHANNEL_GG_CS_CR_ADD_ERROR)
> //.maximumRedeliveries(2)
>                                 //.initialRedeliveryDelay(1)
>                                 .loggingLevel(LoggingLevel.DEBUG)
>                 ).processRef("changeRequestController")
>                 .to(Constants.CHANNEL_GG_CS_COMMAND_CLUSTER);
>
>
>         // Route for command status updates.
>         from(Constants.CHANNEL_GG_CS_COMMAND_STATUS)
>                 .errorHandler(
>
> deadLetterChannel(Constants.CHANNEL_GG_CS_COMMAND_STATUS_ERROR).maximumRedeliveries(2)
>                                 .initialRedeliveryDelay(1)
>                                 .loggingLevel(LoggingLevel.INFO)
>                 ).to("bean:changeRequestController?methodName=onMessage");
> *
>
> So when I get a message on *Constants.CHANNEL_GG_CS_CR_ADD my
> process(Exchange) method is called, and that rout is fine.
>
> However, I get a response message back on **Constants.CHANNEL_GG_CS_COMMAND_STATUS
> but it is also processed by *the *process(Exchange) instead of my
> onMessage**(Exchange)*
>
> I have tried @MessageDriven annotation as well as the route builder but
> neither works.
>
> Am I forced to have each process in a single class?
>
>
>
> --
> ---
> Thank You…
>
> Mick Knutson
> BASE Logic, inc.
> (415) 354-4215
>
> Website: http://baselogic.com
> Blog: http://baselogic.com/blog
> BLiNC Magazine: http://blincmagazine.com
> Linked IN: http://linkedin.com/in/mickknutson
> DJ Mick: http://djmick.com
> MySpace: http://myspace.com/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
>
>


-- 
---
Thank You…

Mick Knutson
BASE Logic, inc.
(415) 354-4215

Website: http://baselogic.com
Blog: http://baselogic.com/blog
BLiNC Magazine: http://blincmagazine.com
Linked IN: http://linkedin.com/in/mickknutson
DJ Mick: http://djmick.com
MySpace: http://myspace.com/mickknutson
Vacation Rental: http://tahoe.baselogic.com