[
https://issues.apache.org/jira/browse/QPID-2451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846587#action_12846587
]
Alan Conway commented on QPID-2451:
-----------------------------------
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();
};
> Add support for MessageListener callback objects in new messaging 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]