I ma using Java DSL right now for the routing.

And just to make sure I am going down the correct path, here is what I am
trying to do with these consumers:

I want a server to create a Status Message to a TOPIC. I then want remote
Consumers to get this message they are subscribing to.

I tried to use the visio stencils you have here.

The issue is how would I create a unit test for this to ensure multiple
clients get this message?

---
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 Mon, Aug 3, 2009 at 8:01 AM, Willem Jiang <willem.ji...@gmail.com> wrote:

> How do you set the routing rule?
> Using the spring or Java DSL ?
>
> Please make sure the mock url is right.
>
> Willem
>
>
> Mick Knutson wrote:
>
>> Here is the unit test:
>>
>>    *...@produce(uri = "seda:foo")
>>    protected ProducerTemplate producer;
>>
>>    @EndpointInject(uri = "mock:result")
>>    protected MockEndpoint mock;
>>
>>    *...@test
>>    public void testReceiveGameStateUpdateMessage() throws Exception {
>>        log.info("testReceiveGameStateUpdateMessage");
>>
>>        // we expect Hello World received in our mock endpoint
>>        mock.expectedBodiesReceived("Hello World");
>>
>>        // we use the producer template to send a message to the seda:start
>> endpoint
>>        producer.sendBody("seda:start", "Hello World");
>>        producer.sendBodyAndHeader("<table/>", "foo", "bar");
>>
>>        // we consume the body from seda:start
>>        //String body = consumer.receiveBody("seda:start", String.class);
>>        String body = consumer.receiveBody("seda:start", String.class);
>>
>>        assertEquals("Hello World", body);
>>        log.info("**************************");
>>        log.info("... the result is: " + body);
>>
>>        // and then we send the body again to seda:foo so it will be routed
>> to the mock
>>        // endpoint so our unit test can complete
>>        producer.sendBody("seda:foo", body);
>>
>>        // assert mock received the body
>>        mock.assertIsSatisfied();
>>     }*
>>
>> The assertEquals passes, but mock.assert fails.
>>
>> I use
>>
>>    *...@endpointinject(name = "result")
>>    private MockEndpoint mock;*
>>
>> but got this error:
>>
>> *java.lang.IllegalArgumentException: registry entry called result of type
>> org.apache.camel.Endpoint must be specified
>> *
>>
>>
>> Not sure why. I was trying to follow the example. But this seems to work
>> from the consumer standpoint, just not the Mock part.
>>
>>
>>
>>
>> ---
>> 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 Sun, Aug 2, 2009 at 8:57 PM, Willem Jiang <willem.ji...@gmail.com>
>> wrote:
>>
>>  Can you show me the unit test code?
>>> It should be easy to find a way to resolve this issue
>>>
>>>
>>> Willem
>>>
>>>
>>> Mick Knutson wrote:
>>>
>>>  That appeared to work for creating the consumerTemplate and allowing me
>>>> to
>>>> Autowire it.
>>>>
>>>> But I am not able to get the mock to validate then. Maybe something
>>>> simple
>>>> now:
>>>>
>>>> *Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 20.122
>>>> sec
>>>> <<< FAILURE!
>>>>
>>>>
>>>> testReceiveGameStateUpdateMessage(com.wiredducks.service.test.TableServiceTest)
>>>> Time elapsed: 20.019 sec  <<< FAILURE!
>>>> java.lang.AssertionError: mock://result Received message count.
>>>> Expected:
>>>> <1> but was: <0>
>>>> *
>>>>
>>>> This is my Mock:
>>>>   @EndpointInject(uri = "mock:result")
>>>>   protected MockEndpoint mock;
>>>>
>>>>
>>>> This is all I see from the logs:
>>>>
>>>> *5371 [main] INFO  org.apache.camel.component.mock.MockEndpoint  -
>>>> Asserting: Endpoint[mock://result] is satisfied
>>>> *
>>>>
>>>>
>>>> But this is good progress I think.
>>>>
>>>>
>>>> ---
>>>> 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 Sun, Aug 2, 2009 at 8:09 PM, Willem Jiang <willem.ji...@gmail.com>
>>>> wrote:
>>>>
>>>>  Hi,
>>>>
>>>>> I just found this is a bug of Camel.  I'm working on the quick fix
>>>>> now[1].
>>>>> Here is a way that you can walk around this issue, by putting the
>>>>> consumerTemplate definition inside the camel context.
>>>>>
>>>>>
>>>>>   <camel:camelContext id="camel">
>>>>>       <camel:consumerTemplate id="consumer"/>
>>>>>   </camel:camelContext>
>>>>>   <camel:template id="producer"/>
>>>>>
>>>>>
>>>>> [1] https://issues.apache.org/activemq/browse/CAMEL-1870
>>>>>
>>>>>
>>>>> Willem
>>>>>
>>>>> Mick Knutson wrote:
>>>>>
>>>>>  I am using 2.0-M3
>>>>>
>>>>>> Should be trying the trunk instead?
>>>>>>
>>>>>> ---
>>>>>> 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 Sun, Aug 2, 2009 at 7:43 PM, Willem Jiang <willem.ji...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>  Which version of Camel are you using ?
>>>>>>
>>>>>>  I just checked current Camel 2.0 trunk code, the <camel:consumer> tag
>>>>>>> should work. Can you try to use the recent released Camel 2.0 M3 ?
>>>>>>>
>>>>>>> Willem
>>>>>>>
>>>>>>>
>>>>>>> Mick Knutson wrote:
>>>>>>>
>>>>>>>  I am trying to follow:
>>>>>>>
>>>>>>>  http://camel.apache.org/polling-consumer.html
>>>>>>>>
>>>>>>>> Now in my camel-client.xml I defined:
>>>>>>>> *<beans xmlns="http://www.springframework.org/schema/beans"*
>>>>>>>> *       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"*
>>>>>>>> *       xmlns:camel="http://camel.apache.org/schema/spring"*
>>>>>>>> *       xsi:schemaLocation="*
>>>>>>>> *        http://www.springframework.org/schema/beans
>>>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd*
>>>>>>>> *        http://camel.apache.org/schema/spring
>>>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd";>*
>>>>>>>>
>>>>>>>>
>>>>>>>> *    <!-- START SNIPPET: e2 -->*
>>>>>>>> *    <camel:camelContext id="camel"/>*
>>>>>>>> *    <camel:template id="producer"/>*
>>>>>>>> *   <camel:consumerTemplate id="consumer"/> *
>>>>>>>>
>>>>>>>> But I keep getting:
>>>>>>>>
>>>>>>>> *The matching wildcard is strict, but no declaration can be found
>>>>>>>> for
>>>>>>>> element 'camel:consumerTemplate'.*
>>>>>>>>
>>>>>>>> Then I changed it to:
>>>>>>>> *<camel:consumer id="consumer"/> *
>>>>>>>> **
>>>>>>>> **
>>>>>>>> But still get*
>>>>>>>> *
>>>>>>>> *Caused by:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
>>>>>>>> Configuration problem: Cannot locate BeanDefinitionParser for
>>>>>>>> element
>>>>>>>> [consumer]*
>>>>>>>> *Offending resource: class path resource [camel-client.xml]*
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---
>>>>>>>> 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
>>>>>>>> ---
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>
>

Reply via email to