Fork me on GitHub
Data Structures | Macros | Typedefs | Functions
janus_rabbitmq.c File Reference

Janus RabbitMQ transport plugin. More...

#include "transport.h"
#include <amqp.h>
#include <amqp_framing.h>
#include <amqp_tcp_socket.h>
#include <amqp_ssl_socket.h>
#include "../debug.h"
#include "../apierror.h"
#include "../config.h"
#include "../mutex.h"
#include "../utils.h"
Include dependency graph for janus_rabbitmq.c:

Data Structures

struct  janus_rabbitmq_client
struct  janus_rabbitmq_response


#define JANUS_RABBITMQ_DESCRIPTION   "This transport plugin adds RabbitMQ support to the Janus API via rabbitmq-c."
#define JANUS_RABBITMQ_NAME   "JANUS RabbitMQ transport plugin"
#define JANUS_RABBITMQ_AUTHOR   "Meetecho s.r.l."
#define JANUS_RABBITMQ_PACKAGE   "janus.transport.rabbitmq"


typedef struct janus_rabbitmq_client janus_rabbitmq_client
typedef struct janus_rabbitmq_response janus_rabbitmq_response


janus_transportcreate (void)
int janus_rabbitmq_init (janus_transport_callbacks *callback, const char *config_path)
void janus_rabbitmq_destroy (void)
int janus_rabbitmq_get_api_compatibility (void)
int janus_rabbitmq_get_version (void)
const char * janus_rabbitmq_get_version_string (void)
const char * janus_rabbitmq_get_description (void)
const char * janus_rabbitmq_get_name (void)
const char * janus_rabbitmq_get_author (void)
const char * janus_rabbitmq_get_package (void)
gboolean janus_rabbitmq_is_janus_api_enabled (void)
gboolean janus_rabbitmq_is_admin_api_enabled (void)
int janus_rabbitmq_send_message (janus_transport_session *transport, void *request_id, gboolean admin, json_t *message)
void janus_rabbitmq_session_created (janus_transport_session *transport, guint64 session_id)
void janus_rabbitmq_session_over (janus_transport_session *transport, guint64 session_id, gboolean timeout, gboolean claimed)
void janus_rabbitmq_session_claimed (janus_transport_session *transport, guint64 session_id)
void * janus_rmq_in_thread (void *data)
void * janus_rmq_out_thread (void *data)

Detailed Description

Janus RabbitMQ transport plugin.

Lorenzo Miniero

This is an implementation of a RabbitMQ transport for the Janus API, using the rabbitmq-c library ( This means that this module adds support for RabbitMQ based messaging as an alternative "transport" for API requests, responses and notifications. This is only useful when you're wrapping Janus requests in your server application, and handling the communication with clients your own way. At the moment, only a single "application" can be handled at the same time, meaning that Janus won't implement multiple queues to handle multiple concurrent "application servers" taking advantage of its features. Support for this is planned, though (e.g., through some kind of negotiation to create queues on the fly). Right now, you can only configure the address of the RabbitMQ server to use, and the queues to make use of to receive (to-janus) and send (from-janus) messages from/to an external application. As with WebSockets, considering that requests wouldn't include a path to address some mandatory information, these requests addressed to Janus should include as part of their payload, when needed, additional pieces of information like session_id and handle_id. That is, where you'd send a Janus request related to a specific session to the /janus/ <session> path, with RabbitMQ you'd have to send the same request with an additional session_id field in the JSON payload.

When you create a session using RabbitMQ, a subscription to the events related to it is done automatically through the outgoing queue, so no need for an explicit request as the GET in the plain HTTP API.


Macro Definition Documentation

#define JANUS_RABBITMQ_AUTHOR   "Meetecho s.r.l."
#define JANUS_RABBITMQ_DESCRIPTION   "This transport plugin adds RabbitMQ support to the Janus API via rabbitmq-c."
#define JANUS_RABBITMQ_NAME   "JANUS RabbitMQ transport plugin"
#define JANUS_RABBITMQ_PACKAGE   "janus.transport.rabbitmq"

Typedef Documentation

Function Documentation

janus_transport* create ( void  )
void janus_rabbitmq_destroy ( void  )
int janus_rabbitmq_get_api_compatibility ( void  )
const char * janus_rabbitmq_get_author ( void  )
const char * janus_rabbitmq_get_description ( void  )
const char * janus_rabbitmq_get_name ( void  )
const char * janus_rabbitmq_get_package ( void  )
int janus_rabbitmq_get_version ( void  )
const char * janus_rabbitmq_get_version_string ( void  )
int janus_rabbitmq_init ( janus_transport_callbacks callback,
const char *  config_path 
gboolean janus_rabbitmq_is_admin_api_enabled ( void  )
gboolean janus_rabbitmq_is_janus_api_enabled ( void  )
int janus_rabbitmq_send_message ( janus_transport_session transport,
void *  request_id,
gboolean  admin,
json_t message 
void janus_rabbitmq_session_claimed ( janus_transport_session transport,
guint64  session_id 
void janus_rabbitmq_session_created ( janus_transport_session transport,
guint64  session_id 
void janus_rabbitmq_session_over ( janus_transport_session transport,
guint64  session_id,
gboolean  timeout,
gboolean  claimed 
void * janus_rmq_in_thread ( void *  data)
void * janus_rmq_out_thread ( void *  data)