Skip to content

Commit

Permalink
Added experimental support to RabbitMQ as a transport for the Janus API
Browse files Browse the repository at this point in the history
  • Loading branch information
meetecho committed Sep 23, 2014
1 parent 561495c commit ead4581
Show file tree
Hide file tree
Showing 17 changed files with 803 additions and 100 deletions.
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ janus_LDADD = \
-lsrtp \
$(NULL)

BUILT_SOURCES = cmdline.c
BUILT_SOURCES = cmdline.c cmdline.h

cmdline.c: janus.ggo
gengetopt --set-package="janus" --set-version="$(VERSION)" < $^

EXTRA_DIST += janus.ggo
CLEANFILES += cmdline.c
CLEANFILES += cmdline.c cmdline.h

##
# Plugins
Expand Down
47 changes: 41 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ To install it, you'll need to satisfy the following dependencies:
are interested in Data Channels)
* [libwebsock](https://github.com/payden/libwebsock) (only needed if
you are interested in WebSockets support)
* [rabbitmq-c](https://github.com/alanxz/rabbitmq-c) (only needed if
you are interested in RabbitMQ support)

A couple of plugins depend on a few more libraries:

Expand Down Expand Up @@ -91,8 +93,27 @@ later version. In fact, recent versions of libwebsock added support for
threading in the library, but it is currently experimental and doesn't
work as expected in Janus.

Should you be interested in building the gateway documentation as well,
you'll need an additional component installed too:
Finally, the same can be said for rabbitmq-c as well, which is needed
for the optional RabbitMQ support. In fact, several different versions
of the library can be found, and the versions usually available in most
distribution repositories are not up-do-date with respect to the current
state of the development. As such, if you're interested in integrating
RabbitMQ queues as an alternative (or replacement) to HTTP and/or
WebSockets to control Janus, you can install the latest version with the
following steps:

git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git submodule init
git submodule update
autoreconf -i
configure --prefix=/usr && make && sudo make install

* *Note:* you may need to pass --libdir=/usr/lib64 to the configure
script if you're installing on a x86_64 distribution.

To conclude, should you be interested in building the gateway
documentation as well, you'll need some additional tools too:

* [Doxygen](http://www.doxygen.org)
* [Graphviz](http://www.graphviz.org/)
Expand All @@ -118,10 +139,15 @@ usual to start the whole compilation process:
make
make install

If you're not interested in Data Channels or WebSockets (or you don't
care about either of them) you can disable them when configuring:
* *Note:* please beware that subsequent ```make install``` commands will
likely overwrite any configuration file you may have edited, so make
sure you backup them before updating a Janus installation.

If you're not interested in Data Channels, WebSockets and/or RabbitMQ
(or you don't care about either of them) you can disable them when
configuring:

./configure --disable-websockets --disable-data-channels
./configure --disable-websockets --disable-data-channels --disable-rabbitmq

If Doxygen and graphviz are available, the process will also build the
documentation for you. If you prefer not to build it, use the
Expand All @@ -144,7 +170,7 @@ or on the command line:

<installdir>/bin/janus --help

janus 0.0.5
janus 0.0.6

Usage: janus [OPTIONS]...

Expand Down Expand Up @@ -202,6 +228,15 @@ or on the command line:
to be accepted by Janus (useful when wrapping
Janus API requests in a server, none by
default)
-R, --enable-rabbitmq Enable RabbitMQ support (default=off)
-H, --rabbitmq-host=string Address (host:port) of the RabbitMQ server to
use (default=localhost:5672)
-t, --rabbitmq-in-queue=string
Name of the RabbitMQ queue for incoming
messages (no default)
-f, --rabbitmq-out-queue=string
Name of the RabbitMQ queue for outgoing
messages (no default)

Options passed through the command line have the precedence on those
specified in the configuration file. To start the gateway, simply run:
Expand Down
25 changes: 25 additions & 0 deletions conf/janus.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ ws_ssl = no ; Whether to enable secure WebSockets
;ws_secure_port = 8989; ; WebSockets server secure port, if enabled


; Recent versions of Janus now also support 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. If you're using the same RabbitMQ
; server instance for multiple Janus instances, make sure you configure
; different queues for each of them (e.g., from-janus-1/to-janus-1 and
; from-janus-2/to-janus-2), or otherwise both the instances will make
; use of the same queues and messages will get lost. The integration
; is disabled by default, so set enable=yes if you want to use it.
[rabbitmq]
enable = no ; Whether the support must be enabled
host = localhost ; The address of the RabbitMQ server
;port = 5672 ; The port of the RabbitMQ server (5672 by default)
to_janus = to-janus ; Name of the queue for incoming messages
from_janus = from-janus ; Name of the queue for outgoing messages


; Janus can also expose an admin/monitor endpoint, to allow you to check
; which sessions are up, which handles they're managing, their current
; status and so on. This provides a useful aid when debugging potential
Expand Down
27 changes: 22 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([Janus Gateway],[0.0.5],[https://github.com/meetecho/janus-gateway],[janus-gateway],[https://janus.conf.meetecho.com])
AC_INIT([Janus Gateway],[0.0.6],[https://github.com/meetecho/janus-gateway],[janus-gateway],[https://janus.conf.meetecho.com])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([foreign subdir-objects])
Expand Down Expand Up @@ -26,16 +26,22 @@ AC_ARG_ENABLE([docs],

AC_ARG_ENABLE([websockets],
[AS_HELP_STRING([--disable-websockets],
[Disable websockets])],
[Disable WebSockets support])],
[],
[enable_websockets=yes])

AC_ARG_ENABLE([data-channels],
[AS_HELP_STRING([--disable-data-channels],
[Disable data channels])],
[Disable DataChannels])],
[],
[enable_data_channels=yes])

AC_ARG_ENABLE([rabbitmq],
[AS_HELP_STRING([--disable-rabbitmq],
[Disable RabbitMQ integration])],
[],
[enable_rabbitmq=yes])

PKG_CHECK_MODULES([JANUS],
[
glib-2.0 >= glib_version
Expand Down Expand Up @@ -74,7 +80,7 @@ AC_CHECK_LIB([websock],
],
[
AS_IF([test "x$enable_websockets" = "xyes"],
[AC_MSG_ERROR([libwebsocket not found. See README for installation instructions or use --disable-websockets])])
[AC_MSG_ERROR([libwebsocket not found. See README.md for installation instructions or use --disable-websockets])])
])

AC_CHECK_LIB([usrsctp],
Expand All @@ -85,7 +91,18 @@ AC_CHECK_LIB([usrsctp],
],
[
AS_IF([test "x$enable_data_channels" = "xyes"],
[AC_MSG_ERROR([libusrsctp not found. See README for installation instructions or use --disable-data-channels])])
[AC_MSG_ERROR([libusrsctp not found. See README.md for installation instructions or use --disable-data-channels])])
])

AC_CHECK_LIB([rabbitmq],
[amqp_error_string2],
[
AC_DEFINE(HAVE_RABBITMQ)
JANUS_MANUAL_LIBS+=" -lrabbitmq"
],
[
AS_IF([test "x$enable_rabbitmq" = "xyes"],
[AC_MSG_ERROR([rabbitmq-c not found. See README.md for installation instructions or use --disable-rabbitmq])])
])

AC_CHECK_PROG([DOXYGEN],
Expand Down
2 changes: 2 additions & 0 deletions docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ doxygendir = $(htmldir)/janus-gateway-$(VERSION)

EXTRA_DIST = html

all: html-local

html-local:
doxygen janus-doxygen.cfg
cp doxy-boot.js html/
Expand Down
2 changes: 1 addition & 1 deletion docs/janus-doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ PROJECT_NAME = "Janus"
# This could be handy for archiving the generated documentation or
# if some version control system is used.

PROJECT_NUMBER = 0.0.5
PROJECT_NUMBER = 0.0.6

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer
Expand Down
Loading

0 comments on commit ead4581

Please sign in to comment.