qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: Default copy constructor behaviour for the class messaging::Receiver and messaging::Sender
Date Thu, 01 Mar 2012 14:44:41 GMT
On 03/01/2012 10:19 AM, Davide Anastasia wrote:
> What is the default behaviour for the copy constructor of the classes
> messaging::Receiver and messaging::Sender?

All the common classes in the messaging API are 'handles' and can be 
copied and assigned as expected. I.e. if creating a copy, both the 
original and the copy refer to the same sender/receiver/session/connection.

> It seems to me that the
> copy constructor just creates a blank Sender. (messaging::Receiver shows
> the same problem).

It shouldn't. Does the attached example work for you? It creates a very 
simple Producer class with a Sender as a member, uses the default copy 
constructor for that to create a copy of that and then sends a message 
using the sender in both original and copied instance.

(run e.g. the drain example to see the output: drain -f amq.topic)

View raw message