the derived deferred classes now also re-implement the onSuccess() method to ensure that the same object type is returned, to support propert chaining

This commit is contained in:
Emiel Bruijntjes 2014-04-16 11:43:27 +02:00
parent 1fecc57d67
commit e903cdb4ee
5 changed files with 43 additions and 16 deletions

View File

@ -334,11 +334,6 @@ public:
/** /**
* Publish a message to an exchange * Publish a message to an exchange
* *
* If either of the two flags is set, and the message could not immediately
* be published, the message is returned by the server to the client. If you
* want to catch such returned messages, you need to install a handler using
* the onReturned() method.
*
* @param exchange the exchange to publish to * @param exchange the exchange to publish to
* @param routingkey the routing key * @param routingkey the routing key
* @param envelope the full envelope to send * @param envelope the full envelope to send

View File

@ -75,9 +75,17 @@ public:
} }
/** /**
* All the onSuccess() functions defined in the base class are accessible too * Register the function that is called when the cancel operation succeeded
* @param callback
*/ */
using Deferred::onSuccess; DeferredCancel &onSuccess(const SuccessCallback &callback)
{
// call base
Deferred::onSuccess(callback);
// allow chaining
return *this;
}
}; };
/** /**

View File

@ -75,6 +75,19 @@ public:
return *this; return *this;
} }
/**
* Register the function that is called when the consumer starts
* @param callback
*/
DeferredConsumer &onSuccess(const SuccessCallback &callback)
{
// call base
Deferred::onSuccess(callback);
// allow chaining
return *this;
}
/** /**
* Register a function to be called when a message arrives * Register a function to be called when a message arrives
* This fuction is also available as onMessage() because I always forget which name I gave to it * This fuction is also available as onMessage() because I always forget which name I gave to it
@ -102,11 +115,6 @@ public:
// allow chaining // allow chaining
return *this; return *this;
} }
/**
* All the onSuccess() functions defined in the base class are accessible too
*/
using Deferred::onSuccess;
}; };
/** /**

View File

@ -80,9 +80,17 @@ public:
} }
/** /**
* All the onSuccess() functions defined in the base class are accessible too * Register the function that is called when the queue is deleted or purged
* @param callback
*/ */
using Deferred::onSuccess; DeferredDelete &onSuccess(const SuccessCallback &callback)
{
// call base
Deferred::onSuccess(callback);
// allow chaining
return *this;
}
}; };
/** /**

View File

@ -80,9 +80,17 @@ public:
} }
/** /**
* All the onSuccess() functions defined in the base class are accessible too * Register the function that is called when the queue is declared
* @param callback
*/ */
using Deferred::onSuccess; DeferredQueue &onSuccess(const SuccessCallback &callback)
{
// call base
Deferred::onSuccess(callback);
// allow chaining
return *this;
}
}; };
/** /**