camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mick Knutson <mknut...@baselogic.com>
Subject Re: anyone have AMQ VirtualTopic's working in Camel Test?
Date Tue, 11 Aug 2009 16:23:52 GMT
I tried what you suggested with this Broker:

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

    <destinationInterceptors>
        <virtualDestinationInterceptor>
            <virtualDestinations>
                *<compositeTopic name="VirtualTopic.TEST">*
                    <forwardTo>
                        *<topic physicalName="Consumer.A.VirtualTopic.TEST"
/>*
                    </forwardTo>
                </compositeTopic>
            </virtualDestinations>
        </virtualDestinationInterceptor>
    </destinationInterceptors>

</broker>



And then I was sending messages to both the Topic, and the resulting que to
determin what was getting through:

        //Send message to
        producer.sendBody(body+"XXXXXXXXXXXXXXX"+body);
        producer.sendBodyAndHeader("activemq:VirtualTopic.TEST",
body+body+body, "foo", "bar");
        *producer.sendBodyAndHeader("activemq:Consumer.A.VirtualTopic.TEST",
body+"OOOOOOOOOOOO"+body, "foo", "bar");*


But only the last message arrives at my MDP which is the one directly to the
Consumer itself. The 1st 2 did not arrive as expected:

*[myproject] INFO
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1]
StatusUpdateService.onMessage(17) | //-----------------------------*
*------------------------------//*
*[myproject] INFO
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1]
StatusUpdateService.onMessage(18) | //-----------------------------*
*------------------------------//*
*[myproject] INFO
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1]
StatusUpdateService.onMessage(19) | //-----------------------------*
*------------------------------//*
*[myproject] INFO
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1]
StatusUpdateService.onMessage(20) | //-----------------------------*
*------------------------------//*
*[myproject] INFO
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1]
StatusUpdateService.onMessage(21) | //-----------------------------*
*------------------------------//*
*[myproject] INFO
[org.springframework.jms.listener.DefaultMessageListenerContainer#0-1]
StatusUpdateService.onMessage(22) | //-----------------------------*
*------------------------------//*
*ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
ID:L83601HY-3296-1250007358494-2:4:1:1:1, originalDestination = null,
originalTran*
*sactionId = null, producerId = ID:L83601HY-3296-1250007358494-2:4:1:1,
destination = queue://Consumer.A.VirtualTopic.TEST, transactionId = null,
expiration*
* = 0, timestamp = 1250007383823, arrival = 0, brokerInTime = 1250007383823,
brokerOutTime = 1250007383823, correlationId = null, replyTo = null,
persistent*
* = true, type = null, priority = 4, groupID = null, groupSequence = 0,
targetConsumerId = null, compressed = false, userID = null, content = null,
marshall*
*edProperties = org.apache.activemq.util.ByteSequence@16d3536, dataStructure
= null, redeliveryCounter = 0, size = 0, properties = {foo=bar},
readOnlyProper*
*ties = true, readOnlyBody = true, droppable = false, text =
33OOOOOOOOOOOO33}*


I actually zipped up the source here:
http://baselogic.com/temp/services.zip

It should run on its own if you want to see my issue. I cd into the *
table-service-su* DIR and run:
mvn camel:run -e in one cmd prompt.

Then in another one, I run mvn verify -e to run the unit 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 Tue, Aug 11, 2009 at 10:33 AM, Ashwin Karpe <askarpe@progress.com> wrote:

>
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message