Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Internal Stasis APIs. More...
#include "asterisk/stasis.h"
Go to the source code of this file.
Functions | |
struct stasis_subscription * | internal_stasis_subscribe (struct stasis_topic *topic, stasis_subscription_cb callback, void *data, int needs_mailbox, int use_thread_pool, const char *file, int lineno, const char *func) |
Create a subscription. More... | |
Internal Stasis APIs.
This header file is used to define functions that are shared between files that make up Stasis Message Bus API. Functions declared here should not be used by any module outside of Stasis.
If you find yourself needing to call one of these functions directly, something has probably gone horribly wrong.
Definition in file stasis_internal.h.
struct stasis_subscription * internal_stasis_subscribe | ( | struct stasis_topic * | topic, |
stasis_subscription_cb | callback, | ||
void * | data, | ||
int | needs_mailbox, | ||
int | use_thread_pool, | ||
const char * | file, | ||
int | lineno, | ||
const char * | func | ||
) |
Create a subscription.
In addition to being AO2 managed memory (requiring an ao2_cleanup() to free up this reference), the subscription must be explicitly unsubscribed from its topic using stasis_unsubscribe().
The invocations of the callback are serialized, but may not always occur on the same thread. The invocation order of different subscriptions is unspecified.
Note: modules outside of Stasis should use stasis_subscribe.
topic | Topic to subscribe to. |
callback | Callback function for subscription messages. |
data | Data to be passed to the callback, in addition to the message. |
needs_mailbox | Determines whether or not the subscription requires a mailbox. Subscriptions with mailboxes will be delivered on some non-publisher thread; subscriptions without mailboxes will be delivered on the publisher thread. |
use_thread_pool | Use the thread pool for the subscription. This is only relevant if needs_mailbox is non-zero. |
file,lineno,func |
NULL | on error. |
Definition at line 857 of file stasis.c.
References ao2_ref, ao2_t_alloc, ast_asprintf, ast_atomic_fetchadd_int(), ast_cond_init, ast_taskprocessor_build_name(), ast_taskprocessor_get(), AST_TASKPROCESSOR_MAX_NAME, ast_taskprocessor_set_local(), ast_threadpool_serializer(), AST_VECTOR_INIT, stasis_subscription::callback, stasis_subscription::data, make_ari_stubs::file, NULL, send_subscription_subscribe(), STASIS_SUBSCRIPTION_FILTER_NONE, STASIS_SUBSCRIPTION_FORMATTER_NONE, stasis_topic_name(), statistics(), sub, stasis_topic::subscriber_id, subscription_dtor(), threadpool, stasis_subscription::topic, topic_add_subscription(), and TPS_REF_DEFAULT.
Referenced by __stasis_subscribe(), __stasis_subscribe_pool(), and stasis_caching_topic_create().