activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mick Knutson <mknut...@baselogic.com>
Subject Re: Virtual Topic and remote Client consumers
Date Tue, 11 Aug 2009 18:07:49 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 Wed, Aug 5, 2009 at 8:18 AM, Mick Knutson <mknutson@baselogic.com> wrote:

> Here is what I have on my server:
>
>
>     *@EndpointInject(uri="activemq:**VirtualTopic.TABLE.1")
>     ProducerTemplate producer;
>
>     public boolean sendStatusUpdate(String body) {
>         log.info("//------------------**------------------------------**
> ----------------//");
>         log.info("sendStatusUpdate: " + body);
>         log.info("//------------------**------------------------------**
> ----------------//");
>
>         //Send message to
>         producer.sendBody("<hello>**world!</hello>");
>
>         return true;
>     }*
>
>
> Here is my client unit test:
>
>     *@Test
>     public void testGetStatusUpdateMessage() throws Exception {
>         log.info("testGetStatusUpdateMessage");
>
>         TableService tableService = (TableService)
> context.getBean("tableServiceProxy");
>         boolean response = tableService.sendStatusUpdate("123");
>         log.info("... the bet was successfully placed: " + response);
>         assertTrue(response);
>
>         //producer.sendBody("seda:pushStatusUpdate", "123");
>
>         String body =
> consumer.receiveBody("activemq:Player.1.VirtualTopic.TABLE.1",
> String.class);
>
>         assertEquals("Hello World", body);
>
>     }*
>
>
> Now I am not able to get any body messages on *activemq:Player.1.VirtualTopic.TABLE.1
> a*nd I have only used the embedded broker at this point.
>
> So what actually happens is my tests run freezes. I asume it is waiting for
> a message to be delivered onto *activemq:Player.1.VirtualTopic.TABLE.1 *that
> never arrives.
>
>
>
> ---
> 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 4, 2009 at 6:43 PM, Mick Knutson <mknutson@baselogic.com>wrote:
>
>> In theory, the Virtual topics seems to be able to suit my use case. The
>> only issue is trying to test for it.
>>
>> I am working with Camel routing as well. So let me try a bit more to get a
>> working test to send a testMessage into my Virtual topic, then consume it. I
>> think I might be close.
>>
>> I will post the results in the morning.
>>
>> ---
>> 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 4, 2009 at 6:37 PM, Willem Jiang <willem.jiang@gmail.com>wrote:
>>
>>> Hi,
>>>
>>> activemq-camel is much high level API, we should make sure the ActiveMQ
>>> provides this kind of feature.
>>> I just checked the Unit test code, it looks like we need to create the
>>> physical queue before the producer send the message.
>>>
>>> Mick does this OK for you ?
>>> Or you may still need to try durable top subscription.
>>>
>>> Willem
>>>
>>>
>>> Mick Knutson wrote:
>>>
>>>> Where can I find
>>>>
>>>> import org.apache.activemq.spring.ConsumerBean;
>>>>
>>>> I have looked at the activemq-camel and activemq-core jars and they are
>>>> not
>>>> there.
>>>>
>>>> It appears to be just for testing?
>>>>
>>>> ---
>>>> 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 4, 2009 at 1:14 PM, Joe Fernandez <
>>>> joe.fernandez@ttmsolutions.com> wrote:
>>>>
>>>>  In the AMQ source tree, check out
>>>>> .../activemq-core/src/test/java/org/apache/activemq/broker/virtual
>>>>>
>>>>> Joe
>>>>> http://www.ttmsolutions.com
>>>>>
>>>>>
>>>>> Mick Knutson-3 wrote:
>>>>>
>>>>>> I am fine with the default, I guess I just an not clear how to start
>>>>>> writing
>>>>>> a test to verify each piece.
>>>>>>
>>>>>> 1. Testing that my publisher can create messages going to:
>>>>>>        VirtualTopic.*table123 (<name assigned bypublisher>*)
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2. Writing a test that 2 different consumers can consume messages
on
>>>>>>
>>>>>>        Consumer.<name assigned by consumer>.VirtualTopic.*table123
>>>>>>
>>>>> (<name
>>>>>
>>>>>> assigned bypublisher>*)
>>>>>>
>>>>>> Such as:
>>>>>> Consumer.*A*.VirtualTopic.*table123 *
>>>>>>
>>>>>>
>>>>>> and:
>>>>>> Consumer.*B*.VirtualTopic.*table123 *
>>>>>>
>>>>>>
>>>>>>
>>>>>> A JUnit test would be amazing guidence.
>>>>>>
>>>>>>
>>>>>> ---
>>>>>> 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 4, 2009 at 3:52 PM, Joe Fernandez <
>>>>>> joe.fernandez@ttmsolutions.com> wrote:
>>>>>>
>>>>>>
>>>>>>> I believe that by default, the corresponding queue names must
follow
>>>>>>>
>>>>>> this
>>>>>
>>>>>> syntax
>>>>>>>
>>>>>>> Consumer.<name assigned by consumer>.VirtualTopic.<name
assigned by
>>>>>>> publisher>
>>>>>>>
>>>>>>> You can override the default naming convention via the
>>>>>>> <virtualDestinations>
>>>>>>> element.
>>>>>>>
>>>>>>> You might also want to look into using Camel to implement a similar
>>>>>>> messaging pattern (i.e., recipient list).
>>>>>>>
>>>>>>> http://www.enterpriseintegrationpatterns.com/RecipientList.html
>>>>>>>
>>>>>>> Joe
>>>>>>> http://www.ttmsolutions.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Mick Knutson-3 wrote:
>>>>>>>
>>>>>>>> Tell me if this is correct about how to use a Virtual Topic
and
>>>>>>>> remote
>>>>>>>> Client consumers:
>>>>>>>>
>>>>>>>> Basically, I create a Virtual topic as a destination for
a new
>>>>>>>> Message
>>>>>>>>
>>>>>>> I
>>>>>>>
>>>>>>>> create and send it to: "*jms:VirtualTopic.Table.123*"
>>>>>>>>
>>>>>>>> Then by using a remote client running a MDP, I can have each
client
>>>>>>>> subscribe to "*jms:Player.A.VirtualTopic.Table.123*", "*
>>>>>>>> jms:Player.B.VirtualTopic.Table.123*",
>>>>>>>> "*jms:Player.C.VirtualTopic.Table.123
>>>>>>>> *", etc...
>>>>>>>>
>>>>>>>>
>>>>>>>> This will essentially give me, in AMQ, 1 topic for
>>>>>>>> *VirtualTopic.Table.123*and then for each client I start,
I should
>>>>>>>> be
>>>>>>>> able to get a message on a
>>>>>>>> queue "*Player.A.VirtualTopic.Table.123*" ???
>>>>>>>>
>>>>>>>> Just seems like I am missing something on the creation of
the
>>>>>>>> Virtual
>>>>>>>> Topics
>>>>>>>> and the Queues the consumer(s) connect to.
>>>>>>>>
>>>>>>>> Does anyone have examples of this?
>>>>>>>>
>>>>>>>>
>>>>>>>> ---
>>>>>>>> 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
>>>>>>>> ---
>>>>>>>>
>>>>>>>>
>>>>>>>>  --
>>>>>>> View this message in context:
>>>>>>>
>>>>>>>
>>>>> http://www.nabble.com/Virtual-Topic-and-remote-Client-consumers-tp24814828p24815070.html
>>>>>
>>>>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>  --
>>>>> View this message in context:
>>>>>
>>>>> http://www.nabble.com/Virtual-Topic-and-remote-Client-consumers-tp24814828p24815475.html
>>>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message