Same messages to new queue with new destination

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Same messages to new queue with new destination

Optimus
I am currently working on a task which involve functionality of sending duplicate messages to new queue which is directing to fresh location.

The scenario is like this

I have a queue name 'A' where I am receiving messages from long time. Now I need to create a new queue with name 'B' and its destination is 'C'.

Messages of queue A will be saved in queue B at forwarded at location given in C. This C is a tcp location. I have gone through concept virtual-destinations, composite-destinations, message-groups etc but none of these seems to be working for me.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Tim Bain
I'd use a composite queue:
http://activemq.apache.org/virtual-destinations.html (near the bottom)

Tim

On Apr 6, 2017 8:11 AM, "Optimus" <[hidden email]> wrote:

I am currently working on a task which involve functionality of sending
duplicate messages to new queue which is directing to fresh location.

The scenario is like this

I have a queue name 'A' where I am receiving messages from long time. Now I
need to create a new queue with name 'B' and its destination is 'C'.

Messages of queue A will be saved in queue B at forwarded at location given
in C. This C is a tcp location. I have gone through concept
virtual-destinations, composite-destinations, message-groups etc but none of
these seems to be working for me.



--
View this message in context: http://activemq.2283324.n4.
nabble.com/Same-messages-to-new-queue-with-new-destination-tp4724608.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Optimus
@Tim Thanks for sugegstions

The way I have achieved this is

Step 1:- Making a new queue which take data of existing queue

<destinationInterceptors>
<virtualDestinationInterceptor><virtualDestinations>
<compositeQueue name="oldqueuename" forwardOnly="false">
<forwardTo><queue physicalName="newqueuename"/>
</forwardTo>
</compositeQueue></virtualDestinations>
</virtualDestinationInterceptor>
</destinationInterceptors>

Step 2 :- Adding consumer for newly created queue

<networkConnectors>
<networkConnector uri="static:(tcp://machinenameorip:portnumberfor tcp)" staticBridge="true"><staticallyIncludedDestinations>
<queue physicalName="newqueuename"/>
</staticallyIncludedDestinations>
</networkConnector>
</networkConnectors> 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Optimus
After doing these changes, I am able to send new messages form ActiveMQ console.

But my original task involve sending messages through code not through console. With this configuration messages are stored in new queue and stuck at "Messages Enqueued".

Any one have solution for this.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Tim Bain
Sorry for not getting back to you sooner.

With your configuration, messages sent to oldqueuename should be enqueued
on oldqueuename and also a new message that's a copy of the original should
be enqueued on newqueuename. In both cases, the message will show as
enqueued and will only show as dequeued once it is consumed by a consumer
that presumably you control.

If messages from either queue are being enqueued but not dequeued, then the
first question is, "is the consumer for that queue running (without
errors)?" If it's running but no messages are being dispatched to it by the
broker, I'd first check the broker's logs, and then attach a JMX viewer to
the broker process and confirm (in the MBeans section) that the consumer
really is connected to the broker and consuming on that queue. Also, make
sure that if the consumer uses a selector, that it matches the messages.

Tim


On Apr 7, 2017 4:05 AM, "Optimus" <[hidden email]> wrote:

After doing these changes, I am able to send new messages form ActiveMQ
console.

But my original task involve sending messages through code not through
console. With this configuration messages are stored in new queue and stuck
at "Messages Enqueued".

Any one have solution for this.



--
View this message in context: http://activemq.2283324.n4.
nabble.com/Same-messages-to-new-queue-with-new-
destination-tp4724608p4724709.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Optimus
Hi Tim,

I have verified that we have connected and working consumer for both queues. But still messages were not processed. ActiveMq.log file is not point towards any warning or error during this transaction.  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Tim Bain
The next thing I'd do is the suggestion from my earlier email to use JMX to
see what the broker thinks is going on with that queue.

I'd also confirm that the consumer is properly configured to ack messages,
either via auto-ack (the default behavior) or via some form of manual acks
(check that your algorithm is working right if you're doing this).

On Apr 13, 2017 6:53 AM, "Optimus" <[hidden email]> wrote:

> Hi Tim,
>
> I have verified that we have connected and working consumer for both
> queues.
> But still messages were not processed. ActiveMq.log file is not point
> towards any warning or error during this transaction.
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Same-messages-to-new-queue-with-new-
> destination-tp4724608p4724929.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Same messages to new queue with new destination

Optimus
To get expected result, I followed below two steps :-

1. I observed log files that shows which hint towards some corrupt or partial deployed ActiveMQ. SO, I took back up and reinstall the ActiveMQ

2. Below are my final changes in activemq.xml
 
   <destinationInterceptors>
            <virtualDestinationInterceptor>
               <virtualDestinations>
                  <compositeQueue name="exitingqueue">
                      <forwardTo>
                        <queue physicalName="newqueue"/>
                      </forwardTo>
                   </compositeQueue>
                </virtualDestinations>
            </virtualDestinationInterceptor>
        </destinationInterceptors>

        <networkConnectors>
             <networkConnector name="nameofqueue" uri="static:(tcp://Ipadress:61616)">
                <staticallyIncludedDestinations>
                    <queue physicalName="newqueue"/>
                </staticallyIncludedDestinations>
             </networkConnector>
        </networkConnectors>
Loading...