You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Bjand <bj...@danskebank.dk> on 2016/01/26 22:39:23 UTC

Receiving multiple duplicate messages - Beginner question

Hi 

I am new to ActiveMQ and trying to make a Request/Response wrapper in C#
using Apache.NMS.ActiveMQ 1.7.1. So far I am able to setup the connection
and session, and also send and receive message. The only issue is that when
I send one message from a client, the server consumer receives the message 5
to 7 times. Initially I thought that this might be due to not closing the
connection/session, or not acknowledging the message. This seems not to be
the case. Has anyone had a similar experience and found a solution?

The request code is as follows


and the response code is 



Where _manager.Connect creates a connection and session if this has not
already been done. The address simply holds the queue name and if the
message should be persisted.

Any ideas?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Receiving-multiple-duplicate-messages-Beginner-question-tp4706474.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Receiving multiple duplicate messages - Beginner question

Posted by Tim Bain <tb...@alumni.duke.edu>.
I'm still not seeing an acknowledge call on the message.  What am I
missing?
On Jan 28, 2016 11:25 PM, "Bjand" <bj...@danskebank.dk> wrote:

> I made a connection manager, since a connection is also used in a Pub/Sub
> implementation. The connection manager simply holds the Connection,
> Session,
> Username and Password(if they are required), and also ensures closure on
> disposal. The missing code is is the Connect method
>
>
>
> where the Factory is instantiated by
>
>
>
> in the class constructor.
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Receiving-multiple-duplicate-messages-Beginner-question-tp4706474p4706627.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Receiving multiple duplicate messages - Beginner question

Posted by Bjand <bj...@danskebank.dk>.
I made a connection manager, since a connection is also used in a Pub/Sub
implementation. The connection manager simply holds the Connection, Session,
Username and Password(if they are required), and also ensures closure on
disposal. The missing code is is the Connect method



where the Factory is instantiated by



in the class constructor.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Receiving-multiple-duplicate-messages-Beginner-question-tp4706474p4706627.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Receiving multiple duplicate messages - Beginner question

Posted by Tim Bain <tb...@alumni.duke.edu>.
I agree, redelivery of request messages means you're not acking them
correctly, and a change in behavior due to changing your redelivery policy
further proves the point.  You say you're doing that, but I don't see it in
the code you posted.  Am I missing something?

Tim
On Jan 28, 2016 1:43 PM, "Bjand" <bj...@danskebank.dk> wrote:

> Some extra info: I managed to consistently get 1:1 in my request/response
> code. I did this by changing the redeliverypolicy.maximumRedeliveries to 0.
> I don't like this solution, but suggests that problem is acknowledgement of
> messages. I have previously acknowledge in the code by calling the
> msg.acknowledge method. This do not solve the problem.
>
> Another observation is that the problem does not exist when the
> request/response messages are called on the same connection. It is does
> show
> when the response code is running in a windows service, and request is
> called from a client on a different machine.
>
> Any ideas what the hopefully simple problem is?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Receiving-multiple-duplicate-messages-Beginner-question-tp4706474p4706607.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Receiving multiple duplicate messages - Beginner question

Posted by Bjand <bj...@danskebank.dk>.
Some extra info: I managed to consistently get 1:1 in my request/response
code. I did this by changing the redeliverypolicy.maximumRedeliveries to 0.
I don't like this solution, but suggests that problem is acknowledgement of
messages. I have previously acknowledge in the code by calling the
msg.acknowledge method. This do not solve the problem.

Another observation is that the problem does not exist when the
request/response messages are called on the same connection. It is does show
when the response code is running in a windows service, and request is
called from a client on a different machine.

Any ideas what the hopefully simple problem is?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Receiving-multiple-duplicate-messages-Beginner-question-tp4706474p4706607.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.