Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates RabbitMQ logic #2430

Merged
merged 8 commits into from
Jan 29, 2021
Merged

Updates RabbitMQ logic #2430

merged 8 commits into from
Jan 29, 2021

Conversation

chriswiggins
Copy link
Contributor

@chriswiggins chriswiggins commented Nov 10, 2020

The RabbitMQ logic inside Janus followed some conventions that were non-standard. I suspect the author wasn't completely across the way AMQP is supposed to work, which is very easy to do if you don't work with it every day! (I say that from experience 💯 )

  • Publishing to a topic does not require an outgoing queue, just the topic, so the outgoing queues are no longer declared
  • When the janus_exchange_type is topic, we want to be able to name the queue, and then bind an incoming topic from the exchange to that queue, so that functionality has been added (see queue_name variable)
  • Adds options to allow configuring the following queue options: durable, autodelete, exclusive
  • This is all backwards compatible, and won't break existing applications

I understand this is quite a big change, so happy to discuss it in depth. To note also I've moved some of the logic/config around so that it follows exchange/queue/topic process

I'm also still fully testing this, but wanted to open the PR to get initial feedback

- Publishing to a topic does not require an outgoing queue, just the topic, so the outgoing queues are no longer declared
- When the janus_exchange_type is topic, we want to be able to name the queue, and then bind an incoming topic from the exchange to that queue, so that functionality has been added
- This is all backwards compatible with original logic, and won't break existing logic
@januscla
Copy link

Thanks for your contribution, @chriswiggins! Please make sure you sign our CLA, as it's a required step before we can merge this.

@atoppi
Copy link
Member

atoppi commented Nov 10, 2020

@chriswiggins is this still a draft ?

@chriswiggins
Copy link
Contributor Author

@atoppi yes - I'd like to add the ability to make queues exclusive and autoDelete, so will continue working on that until this gets merged in.

@chriswiggins chriswiggins marked this pull request as ready for review November 13, 2020 04:20
@chriswiggins
Copy link
Contributor Author

This is ready now - I haven't been able to test this with the default fanout exchange, is there a test environment that can be used for that?

@lminiero
Copy link
Member

I suspect the author wasn't completely across the way AMQP is supposed to work

That would be me, and that's a realistic assumption 😉

That said, it looks like your PR will be a breaking change: anyone using the RabbitMQ transport plugin in production right now (and I know some companies that do), will find themselves with something that doesn't work anymore, which is why I don't think we can merge it as it is, even if I'm sure it's a considerable enhancement on best common practices.

The default behaviour should still be there, and probably still be the default, at least for a little while (possibly with a big warning on the logs that says it will change sooner or later), while more savvy users can enable your improved support.

Copy link
Member

@atoppi atoppi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this is a nice enhancement from the previous implementation.
However I've added some comments in order to make it back-compatible with existing deployments.

conf/janus.eventhandler.rabbitmqevh.jcfg.sample Outdated Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Outdated Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Outdated Show resolved Hide resolved
events/janus_rabbitmqevh.c Show resolved Hide resolved
transports/janus_rabbitmq.c Show resolved Hide resolved
transports/janus_rabbitmq.c Show resolved Hide resolved
@chriswiggins
Copy link
Contributor Author

Thanks for the feedback @atoppi ! Agreed I haven’t left this completely backwards compatible and the last thing we want is to break production for anyone.

I’ll get on to making those changes early next week

@chriswiggins
Copy link
Contributor Author

@atoppi do you want to have another check now? I've added an option to override the default behaviour of declaring the outgoing queues

@lminiero
Copy link
Member

Thanks for the changes! We're busy at the IETF meeting, so we may not be able to check until next week.

Copy link
Member

@atoppi atoppi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some more comments, see if they all make sense to you.

conf/janus.eventhandler.rabbitmqevh.jcfg.sample Outdated Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Outdated Show resolved Hide resolved
events/janus_rabbitmqevh.c Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Outdated Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Outdated Show resolved Hide resolved
conf/janus.transport.rabbitmq.jcfg.sample Outdated Show resolved Hide resolved
transports/janus_rabbitmq.c Outdated Show resolved Hide resolved
transports/janus_rabbitmq.c Outdated Show resolved Hide resolved
@lminiero
Copy link
Member

@chriswiggins as soon as Alessandro's notes are addressed, I'll make one more review and possibly a small test as well, as I believe we're getting close to this being merged. Thanks again for the improvements!

@lminiero
Copy link
Member

@chriswiggins any updates on the above? Looking forward to review and merge soon 😁
Thanks!

@lminiero
Copy link
Member

lminiero commented Dec 7, 2020

@chriswiggins please notice that I'll have to close the PR if we don't get any feedback soon, as we'll have to assume you've moved on and are not interested in this anymore otherwise (we haven't seen activity from you for 3 weeks). As such, if you'd like to see this merged please address the changes and we'll take care of that. Thanks!

@chriswiggins
Copy link
Contributor Author

Hi team, yes definitely keen on fixing this up as we're actually already using these changes in our production environment. Unfortunately I've got a huge deadline to hit this week so not likely I'll be able to get to this until next week. Is it ok if it waits until then?

@chriswiggins
Copy link
Contributor Author

Just an update - I still want to make all the changes and fixes mentioned above, and will do so, but we've been scrambling to move all our video across to Janus before Google Chrome removes flash in the end of December 😨

This will likely be something I work on when on holiday in January. There's also no RabbitMQ reconnect logic for API comms, where there is for the event channel, so I might fix that too, but will do that in a separate PR.

Happy Holidays to all, and thanks again for such an awesome project with Janus. It really works incredibly well

@chriswiggins
Copy link
Contributor Author

Happy 2021 to all - hopefully the latest commit addresses the issues discussed.

Let me know what else is required?

@lminiero
Copy link
Member

Thanks @chriswiggins! We'll review and test later today, and merge in case 👍

@atoppi
Copy link
Member

atoppi commented Jan 27, 2021

@chriswiggins have you checked that everything works as expected ? (queues declared etc.)

@chriswiggins
Copy link
Contributor Author

@chriswiggins have you checked that everything works as expected ? (queues declared etc.)

I have checked a couple of use cases, is there some form of test suite we can follow to ensure the original functionality doesn't break?

@atoppi
Copy link
Member

atoppi commented Jan 27, 2021

There is no test suite for this case.
It would be enough to check if the default configuration keeps the same topology as before.

@chriswiggins
Copy link
Contributor Author

There is no test suite for this case.
It would be enough to check if the default configuration keeps the same topology as before.

Hey @atoppi - I've verified that by default all stays the same 👍

@atoppi
Copy link
Member

atoppi commented Jan 29, 2021

lgtm, merging.
@chriswiggins thanks for the effort!

@atoppi atoppi merged commit b7b1e9e into meetecho:master Jan 29, 2021
@lminiero
Copy link
Member

Thanks Chris!

@lminiero
Copy link
Member

I guess I should have checked this myself too, instead of trusting the automated builds...

transports/janus_rabbitmq.c:912:5: warning: implicit declaration of function 'strlcpy'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
  912 |     strlcpy(incoming_topic, (char *)d->routing_key.bytes, d->routing_key.len + 1); // Convert the amqp_bytes_t back to char*

which leads to

[ERR] [janus.c:main:5335] 	Couldn't load transport plugin 'libjanus_rabbitmq.so': /home/lminiero/Work/code/test/github/lib/janus/transports/libjanus_rabbitmq.so: undefined symbol: strlcpy

I'll work on a fix shortly.

BogdanovKirill pushed a commit to 3dEYE/janus-gateway that referenced this pull request Mar 10, 2021
commit caaba91
Author: Tijmen de Mes <tijmen@ag-projects.com>
Date:   Tue Feb 23 14:57:17 2021 +0100

    Added Content type to SIP message (meetecho#2567)

    * Added 'content_type' to received SIP MESSAGE
    * Added optional content type in sending SIP MESSAGE

commit c9baba9
Author: Alessandro Toppi <atoppi@meetecho.com>
Date:   Tue Feb 23 11:46:50 2021 +0100

    clang/ubsan fixes (meetecho#2556)

    * Fix some clang warnings.
    * Fix UBSanitizer error when sending RTCP SR.

commit beb28be
Author: Tvildo <davidtamuna@gmail.com>
Date:   Mon Feb 22 09:46:25 2021 -0800

    add call_id in received sip message (meetecho#2563)

    Add call_id in received SIP MESSAGE and INFO

commit 8246452
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 22 11:51:36 2021 +0100

    Fixed missing mutexes around VideoRoom ACL management

commit 4f8943a
Author: Tristan Matthews <tmatth@videolan.org>
Date:   Wed Feb 17 09:32:57 2021 -0500

    ice: fix conncheck typo (meetecho#2560)

    No functional change since the typo was used consistently.

commit 27dc51a
Author: nicolasduteil <nduteil@freedev.org>
Date:   Wed Feb 17 15:27:45 2021 +0100

    feat: add "call_id" to "calling", "declining", "updatingcall" & "incomingcall" events (meetecho#2557)

commit 2c81d02
Author: Hritik Utekar <hritikdrocks@gmail.com>
Date:   Wed Feb 17 19:54:46 2021 +0530

    Video moderation always returns unmuted (meetecho#2559)

commit 6503f42
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Wed Feb 17 13:53:53 2021 +0100

    Fixed typo in keepalive-conncheck usage

commit 1f45e02
Author: Alessandro Toppi <atoppi@meetecho.com>
Date:   Mon Feb 15 16:38:22 2021 +0100

    Set specific versions for Python 3 and meson in janus-ci yml.

commit d7c9ef0
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 15 15:28:48 2021 +0100

    Added audiocodec/videocodec supporto to 'joinandconfigure' in VideoRoom API

commit ad54495
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Fri Feb 12 15:28:21 2021 +0100

    Add new option to configure ICE nomination mode, if libnice is recent enough (meetecho#2541)

    * Add new option to configure ICE nomination mode, if libnice is recent enough
    * Added support for libnice keepalive-conncheck property

commit af8cc6e
Author: Nadin Zajimovic <zayim92@gmail.com>
Date:   Fri Feb 12 09:40:36 2021 +0100

    if inviting on destroy, send BYE instead of 480 response (meetecho#2554)

commit ad8bf79
Author: Alessandro Amirante <alex@meetecho.com>
Date:   Thu Feb 11 17:49:25 2021 +0100

    Fix typo in videoroom docs.

commit 26f5958
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Wed Feb 10 16:51:19 2021 +0100

    Fixed small leak in VideoRoom

commit 8ab7a00
Author: Alessandro Toppi <atoppi@meetecho.com>
Date:   Tue Feb 9 16:51:37 2021 +0100

    Initialize packet.is_rtp to false.

commit 66cf343
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Tue Feb 9 16:05:37 2021 +0100

    Add resolution and bitrate to Record&Play playback

commit 119d220
Author: Aleksander Guryanov <caiiiycuk@gmail.com>
Date:   Tue Feb 9 20:33:23 2021 +0700

    Update janus.d.ts (meetecho#2553)

    Function getBitrate() actually returns a string

commit 41399db
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 16:27:14 2021 +0100

    Allow up to 5 (rather than 3) audio/video codecs in the same VideoRoom

commit b81dd6d
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 16:26:19 2021 +0100

    Allow forcing audio/video codec for VideoRoom publishers via query string

commit 576abf5
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 15:17:56 2021 +0100

    Initialize VideoRoom participant recording state when room recording is active (fixes meetecho#2550)

commit 0ba74fb
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 11:53:42 2021 +0100

    Fixed broken AV1 post-processing

commit 09daec4
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 10:46:06 2021 +0100

    Renamed extern janus_callbacks variables in Lua and Duktape plugins (meetecho#2540)

commit 664022b
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 10:41:38 2021 +0100

    Bumped to version 0.11.1

commit 7732127
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Feb 8 10:37:41 2021 +0100

    Updated Changelog (0.10.10)

commit 24a0eec
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Thu Feb 4 11:53:36 2021 +0100

    Videoroom race condition fixes (see meetecho#2509) (meetecho#2539)

    * Fixed missing room references that could cause crashes during race conditions
    * Fixed rare race condition on publisher join

commit 62440c5
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Thu Feb 4 11:52:44 2021 +0100

    Fix parsing of SDP to find payload type matching profiles (fixes meetecho#2544) (meetecho#2549)

commit 794e89a
Author: Bender <undead-empire@ya.ru>
Date:   Wed Feb 3 20:12:02 2021 +0300

    janus.js (meetecho#2548)

    customizeSdp callback added to handleRemoteJsep to be able to mangle remote SDP if needed

commit 213b6c7
Author: Alessandro Toppi <atoppi@meetecho.com>
Date:   Fri Jan 29 12:13:44 2021 +0100

    Make compiler fail if implicit-function-declaration is encountered.

commit dfa8016
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Fri Jan 29 10:21:50 2021 +0100

    Fixed non-portable call to strlcpy, and comment styles, in RabbitMQ code (see meetecho#2430)

commit b7b1e9e
Merge: 19ecf48 c0f0e1e
Author: Alessandro Toppi <atoppi@meetecho.com>
Date:   Fri Jan 29 08:02:18 2021 +0100

    Merge pull request meetecho#2430 from vgrid/master

    Updates RabbitMQ logic

commit 19ecf48
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Thu Jan 28 11:54:55 2021 +0100

    Fixed VideoRoom docs on ICE Restarts for subscribers (fixes meetecho#2537)

commit 2454802
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Wed Jan 27 11:22:13 2021 +0100

    Allow marking of RTP extensions in MJR recordings (meetecho#2527)

commit 0bb49bc
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Wed Jan 27 11:21:09 2021 +0100

    Moderator based muting/unmuting of VideoRoom streams (meetecho#2513)

commit 5e685e3
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Wed Jan 27 11:19:35 2021 +0100

    Reject a=extmap-allow-mixed in SDP, when offered

commit c0f0e1e
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Wed Jan 27 09:59:02 2021 +1300

    Fix code style comments, also enable routing for direct exchanges

commit 257eb80
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Tue Jan 26 15:00:39 2021 +0100

    Configurable media direction when putting calls on-hold (SIP plugin) (meetecho#2525)

commit 7fb08c2
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Tue Jan 26 12:40:26 2021 +0100

    Added starting DTLS MTU to info returned by Janus API

commit 4d97028
Author: Sami Kuhmonen <sami@tokavuh.com>
Date:   Tue Jan 26 12:53:14 2021 +0200

    Report fail if binding to a socket fails in websockets (meetecho#2534)

commit 674367a
Author: Evgeniy Baranov <jeck.ru@gmail.com>
Date:   Mon Jan 25 12:00:37 2021 +0300

    fix race condition in audiobridge plugin changeroom request (meetecho#2535)

commit 3edb780
Author: Alberto Gonzalez Trastoy <albertogontras@gmail.com>
Date:   Sat Jan 23 14:01:27 2021 -0500

    Janus npm types upgrade (meetecho#2528)

commit 78434aa
Author: August Black <augustblack@gmail.com>
Date:   Sat Jan 23 12:00:52 2021 -0700

    set webrtc-adapter verstion to 7.4.0 (meetecho#2531)

commit 46a6c71
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Thu Jan 21 13:02:06 2021 +0100

    Reduced verbosity of a few LOG_WARN messages at startup

commit 34f6f89
Author: Andrew Lavrentev <andrew.lavrentev@gmail.com>
Date:   Thu Jan 21 14:48:20 2021 +0300

    Feature/enhance typings (meetecho#2518)

commit 16173af
Author: Rémi Vansteelandt <remvst@gmail.com>
Date:   Thu Jan 21 05:39:17 2021 -0500

    Fixed secret authentication on GET requests (meetecho#2524)

commit 62d75ab
Author: Nadin Zajimovic <zayim92@gmail.com>
Date:   Wed Jan 20 11:36:43 2021 +0100

    Dont send bye on early dialog (meetecho#2521)

commit 2141d9b
Author: Yurii Cherniavskyi <yurii.cherniavskyi@gmail.com>
Date:   Wed Jan 20 12:30:30 2021 +0200

    Update Webpack instruction after webrtc-adapter dependency update (meetecho#2519)

commit f994f7c
Author: fbellet <fabrice@bellet.info>
Date:   Wed Jan 20 11:28:17 2021 +0100

    Close nice agent resources asynchronously (meetecho#2492)

commit 79038e0
Author: Sergey Radionov <RSATom@gmail.com>
Date:   Tue Jan 19 18:16:03 2021 +0700

    mqttevh: tls support implementation finished (meetecho#2517)

    * mqttevh: tls support implementation finished
    * mqttevh: MQTTASYNC_OPERATION_INCOMPLETE is not error
    * mqttevh: allow send messages while connecting is still in progress

commit 97cd054
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Mon Jan 18 11:24:48 2021 +0100

    Fixed broken webrtc-adapter links (see meetecho#2515)

commit c0570a9
Author: Tristan Matthews <tmatth@videolan.org>
Date:   Thu Jan 14 13:24:48 2021 -0500

    html: update webrtc-adapter to 7.7.0 (meetecho#2515)

commit f57215a
Author: Lorenzo Miniero <lminiero@gmail.com>
Date:   Thu Jan 14 10:11:57 2021 +0100

    Updated year in demos and docs

commit bbdd3e4
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Tue Nov 17 11:49:42 2020 +1300

    Adds back in default outgoing queue behaviour. Adds support for auto-generated queue_names

commit ed1b5c6
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Thu Nov 12 13:21:08 2020 +1300

    Adds RabbitMQ options for queues, durable, exclusive and autodelete

commit 24594f7
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Wed Nov 11 18:05:24 2020 +1300

    Check RabbitMQ admin topic in a better way

commit 319c6fc
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Wed Nov 11 16:09:26 2020 +1300

    Increase RabbitMQ logging on publish

commit 505eeef
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Tue Nov 10 18:29:59 2020 +1300

    Fix queue_name_admin in rabbitmq transport

commit b3f7ad9
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Tue Nov 10 18:19:07 2020 +1300

    Update rabbitmq logging information

commit f604aeb
Author: Chris Wiggins <chris@wiggins.nz>
Date:   Tue Nov 10 17:23:11 2020 +1300

    Updates RabbitMQ logic

    - Publishing to a topic does not require an outgoing queue, just the topic, so the outgoing queues are no longer declared
    - When the janus_exchange_type is topic, we want to be able to name the queue, and then bind an incoming topic from the exchange to that queue, so that functionality has been added
    - This is all backwards compatible with original logic, and won't break existing logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants