camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashwin Karpe <aska...@progress.com>
Subject Re: anyone have AMQ VirtualTopic's working in Camel Test?
Date Tue, 11 Aug 2009 14:33:24 GMT

Hi,

Looks like you used the little snippet I sent in an as-is mode. I intended
this to be an example.

In any case, you could use something like this in your broker

  <broker xmlns="http://activemq.apache.org/schema/core">
    <destinationInterceptors>
      <virtualDestinationInterceptor>
        <virtualDestinations>
          <compositeTopic name="MY.TOPIC">
            <forwardTo>
              <topic physicalName="BAR" />
            </forwardTo>
          </compositeTopic>
        </virtualDestinations>
      </virtualDestinationInterceptor>
    </destinationInterceptors>

  </broker>  

Notice in this example that the real queue is a queue named FOO and a real
topic is a topic named BAR.

Your consumers should listen on the topic named BAR and your clients should
send to the topi named MY.TOPIC which is a virtual topic. 

All messages sent to MY.TOPIC will be forwarded to subscribers to the topic
named BAR.

Hope this clarifies things. My previous example showed a virtual topic which
had a second level of indirection to a collection of topics which in turn
may have been connected to real topics.

Cheers,

Ashwin... 


Mick Knutson-3 wrote:
> 
> I changed the Topic to *activemq:VirtualTopic.TEST* and the consumer queue
> to *activemq:Consumer.A.VirtualTopic.TEST*
> 
> I see that the MDP and Topic get created:
> 
> [myproject] DEBUG [main]
> DefaultInstrumentationAgent.registerMBeanWithServer(293) | Registered
> MBean
> with objectname:
> org.apache.camel:context=mick-knutsons-macbook.local/camel-2,type=processors,nodeid=to1,name="
> *To[activemq:VirtualTopic.TEST]"*
> [myproject] DEBUG [main] DefaultComponentResolver.resolveComponent(77) |
> Found component: activemq via type:
> org.apache.activemq.camel.component.ActiveMQComponent via:
> META-INF/services/org/apache/camel/component/activemq
> *[myproject] DEBUG [main] DefaultComponent.createEndpoint(77) | Creating
> endpoint uri=[activemq://VirtualTopic.TEST]*, path=[VirtualTopic.TEST],
> parameters=[{}]
> *[myproject] DEBUG [main] DefaultCamelContext.getEndpoint(387) |
> activemq://VirtualTopic.TEST converted to endpoint:
> Endpoint[activemq://VirtualTopic.TEST] by component:
> org.apache.activemq.camel.component.ActiveMQComponent@47b7c1b7*
> [myproject] DEBUG [main]
> DefaultInstrumentationAgent.registerMBeanWithServer(293) | Registered
> MBean
> with objectname:
> org.apache.camel:context=mick-knutsons-macbook.local/camel-2,type=endpoints,name="activemq://VirtualTopic.TEST\?id=0x5cab2ebd"
> [myproject] DEBUG [main] DefaultComponent.createEndpoint(77) | Creating
> endpoint uri=[activemq://Consumer.A.VirtualTopic.TEST],
> path=[Consumer.A.VirtualTopic.TEST], parameters=[{}]
> *[myproject] DEBUG [main] DefaultCamelContext.getEndpoint(387) |
> activemq://Consumer.A.VirtualTopic.TEST converted to endpoint:
> Endpoint[activemq://Consumer.A.VirtualTopic.TEST] by component:
> org.apache.activemq.camel.component.ActiveMQComponent@47b7c1b7*
> [myproject] DEBUG [main]
> DefaultInstrumentationAgent.registerMBeanWithServer(293) | Registered
> MBean
> with objectname:
> org.apache.camel:context=mick-knutsons-macbook.local/camel-2,type=endpoints,name="activemq://Consumer.A.VirtualTopic.TEST\?id=0x561756a4"
> 
> 
> 
> Each was converted to a AMQ Component. Is that correct?
> 
> The MDP gets initialized as the client gets initialized. Then AFTER the
> client and server are both running, then I send a message to the server,
> to
> have the server create a message to the VirtualTopic.TEST
> 
> 
> 
> ---
> 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 10, 2009 at 6:12 PM, Willem Jiang
> <willem.jiang@gmail.com>wrote:
> 
>> According to AMQ's document
>> "The out-of-the-box defaults are described above. Namely that the only
>> virtual topics available must be within the VirtualTopic.> namespace and
>> that the consumer queues are named Consumer.*.VirtualTopic.>."
>>
>> The support is out of box, and there is no addition configuration file
>> for
>> the unit test.
>>
>> BTW, did you start to listen the Consumer.A.VirtualTopic.TEST queue
>> before
>> you send the message to VirtualTopic.TEST ?
>>
>> Willem
>>
>>
>> Mick Knutson wrote:
>>
>>> I thought this was already PART of ActiveMQ not a rule that needed to be
>>> added.
>>> But then again, I am just using an embedded broker for these tests.
>>>
>>> ---
>>> 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 10, 2009 at 2:20 PM, Ashwin Karpe <askarpe@progress.com>
>>> wrote:
>>>
>>>  Hi,
>>>>
>>>> Do you have the rule for the virtual topic setup on the broker. I
>>>> wonder
>>>> if
>>>> this is the issue. This suspiciously sounds like the case. The virtual
>>>> queue/topic is like any other queue or topic from a broker perspective
>>>> and
>>>> only gets interpreted when a payload arrive with the destination name
>>>> set
>>>> to
>>>> a virtual queue/topic.
>>>>
>>>> If a rule is not found the destination name is treated as a normal/real
>>>> queue into which the message is dropped which is why your consumer
>>>> seems
>>>> to
>>>> get the message when it listens on the queue.
>>>>
>>>> You may want to add a virtual topic rule to the Actiemq broker being
>>>> used
>>>> using activemq.xml
>>>>
>>>>
>>>> Mick Knutson-3 wrote:
>>>>
>>>>> from the AMQ list, they suggested I use this JUnit test as an example:
>>>>>
>>>>>
>>>> https://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java
>>>>
>>>>> In the above test, the Producer sends a message to the VirtualTopic
>>>>> and
>>>>> 2
>>>>> Consumers get this message in individual Durable Queue's.
>>>>>
>>>>> When I created this, I publish to:
>>>>>
>>>>> activemq:VirtualTopic.TEST
>>>>>
>>>>> and then I Consume on:
>>>>>
>>>>> activemq:Consumer.A.VirtualTopic.TEST
>>>>>
>>>>>
>>>>>
>>>>> But nothing arrives to my Client. When I change my client to listen on
>>>>>
>>>>> activemq:VirtualTopic.TEST
>>>>>
>>>>>
>>>>>
>>>>> The messages are Consumed by the client. This is not what I want. Does
>>>>> anyone have a working Camel AMQ VirtualTopic JUnit Test that can help
>>>>> me
>>>>> out
>>>>> please?
>>>>>
>>>>> ---
>>>>> 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
>>>>> ---
>>>>>
>>>>>
>>>>>
>>>> -----
>>>> ---
>>>> Ashwin Karpe, Principal Consultant, PS - Opensource Center of
>>>> Competence
>>>> Progress Software Corporation
>>>> 14 Oak Park Drive
>>>> Bedford, MA 01730
>>>> ---
>>>> +1-972-304-9084 (Office)
>>>> +1-972-971-1700 (Mobile)
>>>> ----
>>>> Blog: http://opensourceknowledge.blogspot.com/
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://www.nabble.com/anyone-have-AMQ-VirtualTopic%27s-working-in-Camel-Test--tp24902737p24904788.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>
>>
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: http://www.nabble.com/anyone-have-AMQ-VirtualTopic%27s-working-in-Camel-Test--tp24902737p24918802.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message