You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Alan Conway (JIRA)" <ji...@apache.org> on 2011/05/04 17:02:03 UTC
[jira] [Issue Comment Edited] (QPID-2451) Multi-threaded dispatch
support for the new API.
[ https://issues.apache.org/jira/browse/QPID-2451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846587#comment-12846587 ]
Alan Conway edited comment on QPID-2451 at 5/4/11 3:01 PM:
-----------------------------------------------------------
This is the proposed API, in the messaging namespace:
The message::MessageListener interface is the same as client::MessageListener
{noformat}
/**
* A group of threads that dispatch messages to MessageListener
* objects provided by the user.
*
* Messages from the same session will be dispatched sequentially.
* Messages from different sessions may be dispatched concurrently in
* separate threads.
*/
ListenerThreads {
struct BadReceiver : qpid::Exception {
QPID_CLIENT_EXTERN BadReceiver(const std::string&);
};
struct BadSession : qpid::Exception {
QPID_CLIENT_EXTERN BadSession(const std::string&);
};
/** Create ListenerThreads instance with n dispatch threads started. */
QPID_CLIENT_EXTERN ListenerThreads(unsigned n=0);
/** Stop all dispatch threads. */
QPID_CLIENT_EXTERN ~ListenerThreads();
/**
* Register a listener. The listener's receive() function will be
* called with messages received by the Receiver. The
* listener must not be destroyed while it is in use, @see
* forget()
*
*@param listener User implementation object to receive messages.
*@param receiver Messages received by this Receiver are passed to the listener.
*@exception BadReceiver The Receiver is already associated with a listener.
*@exception BadSession The Receiver's session is already associated
* with a different ListenerThreads instance
*/
void QPID_CLIENT_EXTERN listen(MessageListener& listener, Receiver& receiver);
/**
* Forget about the listener. No more messages will be delivered to it
* it can safely be destroyed.
*/
void QPID_CLIENT_EXTERN forget(listener);
/** Start n dispatch threads. */
void QPID_CLIENT_EXTERN start(unsigned n);
/** Stop n dispatch threads or all threads if n >= size() */
void QPID_CLIENT_EXTERN stop(unsigned n);
/**@return The number of dispatch threads currently running. */
unsigned QPID_CLIENT_EXTERN size();
};
{noformat}
was (Author: aconway):
This is the proposed API, in the messaging namespace:
The message::MessageListener interface is the same as client::MessageListener
/**
* A group of threads that dispatch messages to MessageListener
* objects provided by the user.
*
* Messages from the same session will be dispatched sequentially.
* Messages from different sessions may be dispatched concurrently in
* separate threads.
*/
ListenerThreads {
struct BadReceiver : qpid::Exception {
QPID_CLIENT_EXTERN BadReceiver(const std::string&);
};
struct BadSession : qpid::Exception {
QPID_CLIENT_EXTERN BadSession(const std::string&);
};
/** Create ListenerThreads instance with n dispatch threads started. */
QPID_CLIENT_EXTERN ListenerThreads(unsigned n=0);
/** Stop all dispatch threads. */
QPID_CLIENT_EXTERN ~ListenerThreads();
/**
* Register a listener. The listener's receive() function will be
* called with messages received by the Receiver. The
* listener must not be destroyed while it is in use, @see
* forget()
*
*@param listener User implementation object to receive messages.
*@param receiver Messages received by this Receiver are passed to the listener.
*@exception BadReceiver The Receiver is already associated with a listener.
*@exception BadSession The Receiver's session is already associated
* with a different ListenerThreads instance
*/
void QPID_CLIENT_EXTERN listen(MessageListener& listener, Receiver& receiver);
/**
* Forget about the listener. No more messages will be delivered to it
* it can safely be destroyed.
*/
void QPID_CLIENT_EXTERN forget(listener);
/** Start n dispatch threads. */
void QPID_CLIENT_EXTERN start(unsigned n);
/** Stop n dispatch threads or all threads if n >= size() */
void QPID_CLIENT_EXTERN stop(unsigned n);
/**@return The number of dispatch threads currently running. */
unsigned QPID_CLIENT_EXTERN size();
};
> Multi-threaded dispatch support for the new API.
> ------------------------------------------------
>
> Key: QPID-2451
> URL: https://issues.apache.org/jira/browse/QPID-2451
> Project: Qpid
> Issue Type: New Feature
> Components: C++ Client
> Reporter: Alan Conway
> Assignee: Alan Conway
> Priority: Minor
>
> The old C++ client API allows the use to register an object derived from MessageListener as a callback to receive messages from the subscriptions associated with a session. The user can start a thread for each session to dispatch callbacks.
> We need a callback API for the new messaging API. The new API should allow the user to create a thread pool to dispatch to any number of sessions rather than requiring a thread per session. Note the pool model does also support thread-per-session by creating a pool of size 1 for each session.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org