You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chris Audley <ch...@beacon-cs.com> on 2009/09/05 04:18:01 UTC

Can't get simple test to work

I'm trying to setup a simple test route so I can start testing some
Processors I've written.

In spring, I create a very simple context

  <camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
    <route>
      <from uri="direct:testing"/>
    </route>
  </camelContext>

I inject this context into another bean and later that bean runs some
code to send a message to the route

        ProducerTemplate template =
camelContext.createProducerTemplate();
        tempate.sendBody("direct:testing", "testing");

When I run the sendBody line, I get this message in the log

Sep 4, 2009 10:11:56 PM org.apache.camel.component.direct.DirectProducer
process
WARNING: No consumers available on endpoint: Endpoint[direct://testing]
to process: Exchange[Message: [B@de8aa5]

I'm using Camel 2.0.0 with Spring 2.5.6.  I resorted to this test setup
because I wasn't getting anywhere with uri="file:..." based routes.
What the hell am I missing?  I can't believe something this simple
doesn't work.

Re: Can't get simple test to work

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

Your route just have a start endpoint not have the end endpoint, and 
Camel don't know where to deliver the message which is sent to 
"direct:testing" endpoint.
If you just want to test the processor you've written, you can setup the 
route like this

<camelContext id="camel"
  xmlns="http://camel.apache.org/schema/spring">
      <route>
        <from uri="direct:testing"/>
        <process ref="YourProcessor"/>
      </route>
    </camelContext>
<bean id="MyProcessor" class="MY.Processor.Name"/>

Willem

Chris Audley wrote:
> I'm trying to setup a simple test route so I can start testing some
> Processors I've written.
> 
> In spring, I create a very simple context
> 
>   <camelContext id="camel"
> xmlns="http://camel.apache.org/schema/spring">
>     <route>
>       <from uri="direct:testing"/>
>     </route>
>   </camelContext>
> 
> I inject this context into another bean and later that bean runs some
> code to send a message to the route
> 
>         ProducerTemplate template =
> camelContext.createProducerTemplate();
>         tempate.sendBody("direct:testing", "testing");
> 
> When I run the sendBody line, I get this message in the log
> 
> Sep 4, 2009 10:11:56 PM org.apache.camel.component.direct.DirectProducer
> process
> WARNING: No consumers available on endpoint: Endpoint[direct://testing]
> to process: Exchange[Message: [B@de8aa5]
> 
> I'm using Camel 2.0.0 with Spring 2.5.6.  I resorted to this test setup
> because I wasn't getting anywhere with uri="file:..." based routes.
> What the hell am I missing?  I can't believe something this simple
> doesn't work.
> 


Re: How complete is route check (was: Can't get simple test to work)

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Sep 5, 2009 at 3:01 PM, Chris Audley<ch...@beacon-cs.com> wrote:
>
> Thanks for the quick answer.  I had removed my processor for the example in my question, but my processor is InOut as well, so the same issue applies.  I hadn't understood the roll of the mock uris.
>
> So Camel ignores routes that don't end in a producer.  How complete is this check?  If I create something like the following:
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>  <route>
>    <from uri="direct:start"/>
>    <multicast>
>      <to uri="mock:result"/>
>      <unmarshall/>
>    </multicast>
>  </route>
> </camelContext>
>
> Will camel detect that the unmarshall doesn't lead to a producer and ignore the entire route, or will it allow it because of the <to/> producer?
>

No as Camel provides a real DSL underneath for routing that allows you
to build routes in lego style. As there are 50+ operations then there
are many combinations. And what if there was a mistake in the
detection then the possible was suddenly impossible.

For such checks it would be IMHO better if tooling could "babysit"
engineers. For example:
http://fusesource.com/products/fuse-integration-designer/

PS: Your case is in fact possible as if you are doing InOut routing
then the reply to the client would be the unmarshalled payload.

PPS: Each operation should of course be able to validate that its
configured properly so unmarshal so state which data format you should
use etc.

> -----Original Message-----
> From: Mick Knutson [mailto:mknutson@baselogic.com]
> Sent: Sat 9/5/2009 2:50 AM
> To: users@camel.apache.org
> Subject: Re: Can't get simple test to work
>
> I would suggest you look at the Camel Mock page:
> http://camel.apache.org/mock.html
>
> try something like:
>
> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
>
>  <route>
>    <from uri="seda:start"/>
>    <to uri="mock:result"/>
>
>  </route>
> </camelContext>
>
> from:
> http://camel.apache.org/spring.html
>
>
> Basically, you created a direct starting point, but that goes nowhere. By
> adding a mock, the mock will now consume the messages from the seda:start,
> then you can measure and test if the mock gets what you expect.
>
>
> ---
> Thank You.
>
> Mick Knutson, President
>
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring & Agile Consulting
> p. (866) BLiNC-411: (254-6241-1)
> f. (415) 685-4233
>
> Website: http://baselogic.com
> Linked IN: http://linkedin.com/in/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
> ---
>
>
>
> On Fri, Sep 4, 2009 at 7:18 PM, Chris Audley <ch...@beacon-cs.com>wrote:
>
>> I'm trying to setup a simple test route so I can start testing some
>> Processors I've written.
>>
>> In spring, I create a very simple context
>>
>>  <camelContext id="camel"
>> xmlns="http://camel.apache.org/schema/spring">
>>    <route>
>>      <from uri="direct:testing"/>
>>    </route>
>>  </camelContext>
>>
>> I inject this context into another bean and later that bean runs some
>> code to send a message to the route
>>
>>        ProducerTemplate template =
>> camelContext.createProducerTemplate();
>>        tempate.sendBody("direct:testing", "testing");
>>
>> When I run the sendBody line, I get this message in the log
>>
>> Sep 4, 2009 10:11:56 PM org.apache.camel.component.direct.DirectProducer
>> process
>> WARNING: No consumers available on endpoint: Endpoint[direct://testing]
>> to process: Exchange[Message: [B@de8aa5]
>>
>> I'm using Camel 2.0.0 with Spring 2.5.6.  I resorted to this test setup
>> because I wasn't getting anywhere with uri="file:..." based routes.
>> What the hell am I missing?  I can't believe something this simple
>> doesn't work.
>>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

How complete is route check (was: Can't get simple test to work)

Posted by Chris Audley <ch...@beacon-cs.com>.
Thanks for the quick answer.  I had removed my processor for the example in my question, but my processor is InOut as well, so the same issue applies.  I hadn't understood the roll of the mock uris.

So Camel ignores routes that don't end in a producer.  How complete is this check?  If I create something like the following:

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="direct:start"/>
    <multicast>
      <to uri="mock:result"/>
      <unmarshall/>
    </multicast>
  </route>
</camelContext>

Will camel detect that the unmarshall doesn't lead to a producer and ignore the entire route, or will it allow it because of the <to/> producer?

-----Original Message-----
From: Mick Knutson [mailto:mknutson@baselogic.com]
Sent: Sat 9/5/2009 2:50 AM
To: users@camel.apache.org
Subject: Re: Can't get simple test to work
 
I would suggest you look at the Camel Mock page:
http://camel.apache.org/mock.html

try something like:

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

  <route>
    <from uri="seda:start"/>
    <to uri="mock:result"/>

  </route>
</camelContext>

from:
http://camel.apache.org/spring.html


Basically, you created a direct starting point, but that goes nowhere. By
adding a mock, the mock will now consume the messages from the seda:start,
then you can measure and test if the mock gets what you expect.


---
Thank You.

Mick Knutson, President

BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233

Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---



On Fri, Sep 4, 2009 at 7:18 PM, Chris Audley <ch...@beacon-cs.com>wrote:

> I'm trying to setup a simple test route so I can start testing some
> Processors I've written.
>
> In spring, I create a very simple context
>
>  <camelContext id="camel"
> xmlns="http://camel.apache.org/schema/spring">
>    <route>
>      <from uri="direct:testing"/>
>    </route>
>  </camelContext>
>
> I inject this context into another bean and later that bean runs some
> code to send a message to the route
>
>        ProducerTemplate template =
> camelContext.createProducerTemplate();
>        tempate.sendBody("direct:testing", "testing");
>
> When I run the sendBody line, I get this message in the log
>
> Sep 4, 2009 10:11:56 PM org.apache.camel.component.direct.DirectProducer
> process
> WARNING: No consumers available on endpoint: Endpoint[direct://testing]
> to process: Exchange[Message: [B@de8aa5]
>
> I'm using Camel 2.0.0 with Spring 2.5.6.  I resorted to this test setup
> because I wasn't getting anywhere with uri="file:..." based routes.
> What the hell am I missing?  I can't believe something this simple
> doesn't work.
>


Re: Can't get simple test to work

Posted by Mick Knutson <mk...@baselogic.com>.
I would suggest you look at the Camel Mock page:
http://camel.apache.org/mock.html

try something like:

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">

  <route>
    <from uri="seda:start"/>
    <to uri="mock:result"/>

  </route>
</camelContext>

from:
http://camel.apache.org/spring.html


Basically, you created a direct starting point, but that goes nowhere. By
adding a mock, the mock will now consume the messages from the seda:start,
then you can measure and test if the mock gets what you expect.


---
Thank You…

Mick Knutson, President

BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233

Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---



On Fri, Sep 4, 2009 at 7:18 PM, Chris Audley <ch...@beacon-cs.com>wrote:

> I'm trying to setup a simple test route so I can start testing some
> Processors I've written.
>
> In spring, I create a very simple context
>
>  <camelContext id="camel"
> xmlns="http://camel.apache.org/schema/spring">
>    <route>
>      <from uri="direct:testing"/>
>    </route>
>  </camelContext>
>
> I inject this context into another bean and later that bean runs some
> code to send a message to the route
>
>        ProducerTemplate template =
> camelContext.createProducerTemplate();
>        tempate.sendBody("direct:testing", "testing");
>
> When I run the sendBody line, I get this message in the log
>
> Sep 4, 2009 10:11:56 PM org.apache.camel.component.direct.DirectProducer
> process
> WARNING: No consumers available on endpoint: Endpoint[direct://testing]
> to process: Exchange[Message: [B@de8aa5]
>
> I'm using Camel 2.0.0 with Spring 2.5.6.  I resorted to this test setup
> because I wasn't getting anywhere with uri="file:..." based routes.
> What the hell am I missing?  I can't believe something this simple
> doesn't work.
>

Re: Can't get simple test to work

Posted by Dmitry Ulanov <du...@gmail.com>.
You have to setting a consumer endpoint:

<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring">
   <route>
     <from uri="direct:testing"/>
     <to uri="log:com.example?level=INFO"/>
   </route>
 </camelContext>

http://camel.apache.org/log.html

On Sat, Sep 5, 2009 at 6:18 AM, Chris Audley <ch...@beacon-cs.com>wrote:

> I'm trying to setup a simple test route so I can start testing some
> Processors I've written.
>
> In spring, I create a very simple context
>
>  <camelContext id="camel"
> xmlns="http://camel.apache.org/schema/spring">
>    <route>
>      <from uri="direct:testing"/>
>    </route>
>  </camelContext>
>
> I inject this context into another bean and later that bean runs some
> code to send a message to the route
>
>        ProducerTemplate template =
> camelContext.createProducerTemplate();
>        tempate.sendBody("direct:testing", "testing");
>
> When I run the sendBody line, I get this message in the log
>
> Sep 4, 2009 10:11:56 PM org.apache.camel.component.direct.DirectProducer
> process
> WARNING: No consumers available on endpoint: Endpoint[direct://testing]
> to process: Exchange[Message: [B@de8aa5]
>
> I'm using Camel 2.0.0 with Spring 2.5.6.  I resorted to this test setup
> because I wasn't getting anywhere with uri="file:..." based routes.
> What the hell am I missing?  I can't believe something this simple
> doesn't work.
>