So I changed my server context.xml with this broker:

<bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">
        <property name="config"
            value="classpath:META-INF/broker.xml" />
        <property name="start" value="true" />
    </bean>


I then added this broker.xml:

<broker xmlns="http://activemq.apache.org/schema/core";>
    <transportConnectors>
        <transportConnector name="tcp"
            uri="tcp://localhost:61616" />
    </transportConnectors>

    <destinationInterceptors>
        <virtualDestinationInterceptor>
            <virtualDestinations>
                <compositeQueue name="MY.QUEUE">
                    <forwardTo>
                        <filteredDestination selector="odd = 'yes'"
                            queue="FOO" />
                        <filteredDestination selector="i = 5" topic="BAR" />
                    </forwardTo>
                </compositeQueue>
                <virtualTopic name=">" prefix="VirtualTopicConsumers.*." />
            </virtualDestinations>
        </virtualDestinationInterceptor>
    </destinationInterceptors>
</broker>

Then when I start the Client Side Unit Tests:

6178 [main] DEBUG org.apache.camel.component.direct.DirectConsumer  -
Starting consumer: Consumer[direct://start]
 6179 [main] DEBUG org.apache.camel.impl.DefaultCamelContext  - Route 0:
EventDrivenConsumerRoute[Endpoint[activemq://Player.VirtualTopicConsumers.1]
->
UnitOfWork(pipeline[channel[com.wiredducks.service.test.tableservicetest$clientchec...@7acdff36],
Channel[sendTo(Endpoint[mock://player1])]])]
 6180 [main] DEBUG org.apache.camel.impl.DefaultCamelContext  - Route 1:
EventDrivenConsumerRoute[Endpoint[direct://start] ->
UnitOfWork(Channel[sendTo(Endpoint[activemq://VirtualTopicConsumers.1])])]
 6180 [main] DEBUG org.apache.camel.impl.DefaultCamelContext  - Started
routes
 6180 [main] INFO  org.apache.camel.impl.DefaultCamelContext  - Apache Camel
2.0-M3 (CamelContext:camel-2) started
 6180 [main] DEBUG com.wiredducks.service.test.TableServiceTest  - Routing
Rules are: 
*[EventDrivenConsumerRoute[Endpoint[activemq://Player.VirtualTopicConsumers.1]
-> *
UnitOfWork(pipeline[channel[com.wiredducks.service.test.tableservicetest$clientchec...@7acdff36],
Channel[sendTo(Endpoint[mock://player1])]])],
EventDrivenConsumerRoute[Endpoint[direct://start] -> *
UnitOfWork(Channel[sendTo(Endpoint[activemq://VirtualTopicConsumers.1])])]]*
 6180 [main] DEBUG com.wiredducks.service.test.TableServiceTest  - Routing
Rules are:
[EventDrivenConsumerRoute[Endpoint[activemq://Player.VirtualTopicConsumers.1]
->
UnitOfWork(pipeline[channel[com.wiredducks.service.test.tableservicetest$clientchec...@7acdff36],
*Channel[sendTo(Endpoint[mock://player1])]])],
EventDrivenConsumerRoute[Endpoint[direct://start] ->
UnitOfWork(Channel[sendTo(Endpoint[activemq://VirtualTopicConsumers.1])])]]*
 6180 [main] INFO  com.wiredducks.service.test.TableServiceTest  - Invoking
TableService to place a bet of 987 from player 123
 6181 [main] DEBUG org.apache.camel.impl.DefaultComponentResolver  - Found
component: jms via type: org.apache.camel.component.jms.JmsComponent via:
META-INF/services/org/apache/camel/component/jms



When I send a message from my Server to:
producer.sendBodyAndHeader("activemq:VirtualTopicConsumers.1", "888", "foo",
"bar");


---
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 1:48 PM, Ashwin Karpe <aska...@progress.com> wrote:

>
> Hi,
>
> If you do not use a broker.xml to instantiate a broker then you will need
> to
> use brokers API's to add a virtual destination interceptors that
> instanctiate a virtual destination.
>
> An easier way to accomplish this is to instantiate your embedded broker
> using a broker.xml file (provided you use spring). If you had a broker.xml
> then the setup would look as follows.
>
> <broker xmlns="http://activemq.apache.org/schema/core";>
>    <destinationInterceptors>
>      <virtualDestinationInterceptor>
>        <virtualDestinations>
>          <compositeQueue name="MY.QUEUE">
>            <forwardTo>
>              <filteredDestination selector="odd = 'yes'" queue="FOO"/>
>              <filteredDestination selector="i = 5" topic="BAR"/>
>            </forwardTo>
>          </compositeQueue>
>        </virtualDestinations>
>      </virtualDestinationInterceptor>
>    </destinationInterceptors>
>
>  </broker>
>
> Hope this helps.
>
> Cheers,
>
> Ashwin...
>
>
> Mick Knutson-3 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 <aska...@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--tp24902737p24907245.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Reply via email to