Commit Graph

448 Commits

Author SHA1 Message Date
Chunyi Lyu 482bef519d Stop rabbit_mqtt_packet:parse from crashing in web mqtt
- add a wrapper for mqtt parse/2 to prevent crashing when
parse/2 fails to parse a packet
- add invalid packet test case for web mqtt; server will respond
status code 1007, same status code as framing error
2023-01-24 17:30:10 +00:00
Chunyi Lyu fb913009c4 Add func specs for mqtt process_packet and process_request
- removed return matching for {error, Error} when calling process_packet
because that's not the return type
2023-01-24 17:30:10 +00:00
David Ansari bd0acb33e4 Remove test helper util:connect_to_node/3
because this method is superfluous given that util:connect
already exists.
2023-01-24 17:30:10 +00:00
Chunyi Lyu d5e497f8b6 Web mqtt: backfill test for connecting with duplicated id 2023-01-24 17:30:10 +00:00
Chunyi Lyu aa8d16fe94 Web mqtt: return hibernate in handle_credits 2023-01-24 17:30:10 +00:00
Chunyi Lyu 2a7f22fa26 Web mqtt: close connection when receive invalid data
- from https://www.rfc-editor.org/rfc/rfc6455#section-7.4.1,
code `1003` is for "an endpoint is terminating the connection
because it has received a type of data it cannot accept"
2023-01-24 17:30:10 +00:00
Chunyi Lyu b3215ebaf1 Set close header when close connection in web_mqtt init/2 2023-01-24 17:30:10 +00:00
David Ansari 15636fdb90 Rename frame to packet
The MQTT protocol specs define the term "MQTT Control Packet".
The MQTT specs never talk about "frame".

Let's reflect this naming in the source code since things get confusing
otherwise:
Packets belong to MQTT.
Frames belong to AMQP 0.9.1 or web sockets.
2023-01-24 17:30:10 +00:00
David Ansari 86de0a1557 Reduce memory usage of MQTT connection process
by removing the two fields referencing a function:
mqtt2amqp_fun and amqp2mqtt_fun

Each field required 1 words + 11 words for the function reference.

Therefore, for 1 million MQTT connections this commit saves:
    (1+11) * 2 * 1,000,000 words
    = 192 MB of memory

In addition, the code is now simpler to understand.

There is no change in behaviour except for the sparkplug environment
variable being read upon application start.

We put the compiled regexes into persistent term because they are the
same for all MQTT connections.
2023-01-24 17:30:10 +00:00
Chunyi Lyu 1180429c96 Terminate connection if mqtt not found in web sup protocol
- per MQTT spec
2023-01-24 17:30:10 +00:00
David Ansari 7782142020 Reduce memory usage of reader processes
Reduce memory usage of (Web) MQTT connection process and STOMP reader
process by storing the connection name as binary instead of string.

Previously:
82 = erts_debug:size("192.168.2.104:52497 -> 192.168.2.175:1883").

The binary <<"192.168.2.104:52497 -> 192.168.2.175:1883">>
requires 8 words.

So, for 1 million MQTT connections, this commit should save
    (82 - 8) words * 1,000,000
    = 592 MB
of memory.
2023-01-24 17:30:10 +00:00
Chunyi Lyu 46e8a65d96 Check if state.stats_timer is undefined to avoid crashing
- if #state.stats_timer is undefined, rabbit_event:if_enabled crashes
- remove compression related TODO from web_mqtt. It's a intentional
default behavior set in: https://github.com/rabbitmq/rabbitmq-web-mqtt/pull/35
2023-01-24 17:30:10 +00:00
David Ansari 6605a16830 Fix rabbitmq_web_mqtt:system_SUITE-mixed 2023-01-24 17:30:10 +00:00
David Ansari 76f4598d92 Send last will if client did not DISCONNECT
"The Will Message MUST be published when the Network Connection is subsequently
closed unless the Will Message has been deleted by the Server on receipt of a
DISCONNECT Packet [MQTT-3.1.2-8].
Situations in which the Will Message is published include, but are not limited to:
•	An I/O error or network failure detected by the Server.
•	The Client fails to communicate within the Keep Alive time.
•	The Client closes the Network Connection without first sending a DISCONNECT Packet.
•	The Server closes the Network Connection because of a protocol error.
"

Prior to this commit, the will message was not sent in all scenarios
where it should have been sent.

In this commit, the will message is always sent unless the client sent a
DISCONNECT packet to the server.

We achieve this by sending the will message in the terminate callback.

Note that the Reason passed into the terminate callback of
rabbit_web_mqtt_handler is the atom 'stop' (that is, we cannot pass a custom
reason here).

Therefore, in order to know within the terminate callback whether the client
sent a DISCONNECT packet, we have to modify the process state.
Rather than including a new field into the process state record which requires
1 additional word per MQTT connection (i.e. expensive with millions of
MQTT connection processes - we want to keep the process state small),
we intead modify the state just before stopping the process to
{SendWill, State}.
2023-01-24 17:30:10 +00:00
Chunyi Lyu c3779d9996 Implement message consuming counters in mqtt 2023-01-24 17:30:10 +00:00
Chunyi Lyu fb81a92116 Add ws_connect helper to web mqtt tests 2023-01-24 17:29:08 +00:00
David Ansari bda52dbf64 Support consuming classic mirrored queue failover
Some users use classic mirrored queues for MQTT queues by
applying a policy.

Given that classic mirrored queues are deprecated, but still supported
in RabbitMQ 3.x, native MQTT must support classic mirrored queues.
2023-01-24 17:29:07 +00:00
David Ansari 9fd5704e30 Fix mixed version Web MQTT system tests
In mixed verion tests all non-required feature flags are disabled.
Therefore, MQTT client ID tracking happens in Ra.
The Ra client sends commands asynchronously when registering and
deregistering the client ID.

Also, add more tests.
2023-01-24 17:29:07 +00:00
David Ansari 4c15299196 Delete old emqttc client
Instead use latest emqtt client for Web MQTT tests.
2023-01-24 17:29:07 +00:00
Chunyi Lyu df491d3489 Use eqmtt client in web mqtt tests 2023-01-24 17:29:07 +00:00
Chunyi Lyu 1925862b1e Test drain closing connections in web mqtt
- web mqtt connections are tracked by rabbitmq_mqtt and will be
closed by mqtt event handler at node drain.
2023-01-24 17:29:07 +00:00
David Ansari 14f59f1380 Handle soft limit exceeded as queue action
Instead of performing credit_flow within quorum queue and stream queue
clients, return new {block | unblock, QueueName} actions.

The queue client process can then decide what to do.

For example, the channel continues to use credit_flow such that the
channel gets blocked sending any more credits to rabbit_reader.

However, the MQTT connection process does not use credit_flow. It
instead blocks its reader directly.
2023-01-24 17:29:07 +00:00
David Ansari 816fedf080 Enable flow control to target classic queue 2023-01-24 17:29:07 +00:00
David Ansari 627ea8588a Add rabbit_event tests for MQTT
Add tests that MQTT plugin sends correct events to rabbit_event.

Add event connection_closed.
2023-01-24 17:29:07 +00:00
David Ansari af68fb4484 Decrease memory usage of queue_type state
Prior to this commit, 1 MQTT publisher publishing to 1 Million target
classic queues requires around 680 MB of process memory.

After this commit, it requires around 290 MB of process memory.

This commit requires feature flag classic_queue_type_delivery_support
and introduces a new one called no_queue_name_in_classic_queue_client.

Instead of storing the binary queue name 4 times, this commit now stores
it only 1 time.

The monitor_registry is removed since only classic queue clients monitor
their classic queue server processes.

The classic queue client does not store the queue name anymore. Instead
the queue name is included in messages handled by the classic queue
client.

Storing the queue name in the record ctx was unnecessary.

More potential future memory optimisations:
* When routing to destination queues, looking up the queue record,
  delivering to queue: Use streaming / batching instead of fetching all
  at once
* Only fetch ETS columns that are necessary instead of whole queue
  records
* Do not hold the same vhost binary in memory many times. Instead,
  maintain a mapping.
* Remove unnecessary tuple fields.
2023-01-24 17:29:07 +00:00
David Ansari 43bd548dcc Handle deprecated classic queue delivery
when feature flag classic_queue_type_delivery_support is disabled.
2023-01-24 17:29:07 +00:00
Chunyi Lyu 7a325a3a99 Remove deprecated cowboy return types from web mqtt
- change introduced in cowboy 2.5; see:
8404b1c908
2023-01-24 17:29:07 +00:00
David Ansari 5710a9474a Support MQTT Keepalive in WebMQTT
Share the same MQTT keepalive code between rabbit_mqtt_reader and
rabbit_web_mqtt_handler.

Add MQTT keepalive test in both plugins rabbitmq_mqtt and
rabbitmq_web_mqtt.
2023-01-24 17:29:07 +00:00
David Ansari fc33719d77 Use 1 instead of 4 processes per WebMQTT connection
Reducing number of Erlang processes allows better scaling with millions
of clients connecting via MQTT over WebSockets.

In this commit, we partially revert
9c153b2d40
where support for heartbeats were introduced.

Prior to this commit there were 4 processes per WebMQTT connection
supervised by ranch_conns_sup in the ranch application:
1. rabbit_web_mqtt_connection_sup
2. rabbit_web_mqtt_connection_sup (id=rabbit_web_mqtt_keepalive_sup)
3. rabbit_hearbeat (receiver)
4. rabbit_web_mqtt_handler connection process

After this commit, there is only the 4th process supervised directly by
ranch_conns_sup.
2023-01-24 17:29:07 +00:00
David Ansari 6f00ccb3ad Get all existing rabbitmq_web_mqtt tests green 2023-01-24 17:29:07 +00:00
Alexey Lebedeff b6cd708a08 Fix all dialyzer warnings in rabbitmq_web_mqtt 2023-01-19 17:23:23 +01:00
Rin Kuryloski 5ef8923462 Avoid the need to pass package name to rabbitmq_integration_suite 2023-01-18 15:25:27 +01:00
Rin Kuryloski a317b30807 Use improved assert_suites2 macro from rules_erlang 3.9.0 2023-01-18 15:07:06 +01:00
Michael Klishin ec4f1dba7d
(c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
Luke Bakken 7fe159edef
Yolo-replace format strings
Replaces `~s` and `~p` with their unicode-friendly counterparts.

```
git ls-files *.erl | xargs sed -i.ORIG -e s/~s>/~ts/g -e s/~p>/~tp/g
```
2022-10-10 10:32:03 +04:00
Michal Kuratczyk 2855278034
Migrate from supervisor2 to supervisor 2022-09-27 13:53:06 +02:00
Rin Kuryloski 575c5f9975 Remove all of the .travis.yml files
since we no longer use them
2022-08-16 09:46:31 +02:00
Philip Kuryloski 15a79466b1 Use the new xref2 macro from rules_erlang
That adopts the modern erlang.mk xref behaviour
2022-06-09 23:18:28 +02:00
Philip Kuryloski 327f075d57 Make rabbitmq-server work with rules_erlang 3
Also rework elixir dependency handling, so we no longer rely on mix to
fetch the rabbitmq_cli deps

Also:

- Specify ra version with a commit rather than a branch
- Fixup compilation options for erlang 23
- Add missing ra reference in MODULE.bazel
- Add missing flag in oci.yaml
- Reduce bazel rbe jobs to try to save memory
- Use bazel built erlang for erlang git master tests
- Use the same cache for all the workflows but windows
- Avoid using `mix local.hex --force` in elixir rules
  - Fetching seems blocked in CI, and this should reduce hex api usage in
    all builds, which is always nice
- Remove xref and dialyze tags since rules_erlang 3 includes them in
  the defaults
2022-06-08 14:04:53 +02:00
Loïc Hoguin dc70cbf281
Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
Luke Bakken dba25f6462
Replace files with symlinks
This prevents duplicated and out-of-date instructions.
2022-04-15 06:04:29 -07:00
Philip Kuryloski 65a3ac44a5 Adjust some usages of `erlc_opts` for rules_erlang 2.5.1
(cherry picked from commit d7d2352f10)
2022-04-08 22:06:22 +02:00
Michael Klishin c38a3d697d
Bump (c) year 2022-03-21 01:21:56 +04:00
Philip Kuryloski 226e00fcd2 Tighten up dialyzer usage
now that rules_erlang no longer cascades up dialyzer warnings from deps
2022-02-24 11:18:41 +01:00
Philip Kuryloski d8201726ae Ignore dialyzer warnings for most apps 2022-02-21 09:19:56 +01:00
Philip Kuryloski efcd881658 Use rules_erlang v2
bazel-erlang has been renamed rules_erlang. v2 is a substantial
refactor that brings Windows support. While this alone isn't enough to
run all rabbitmq-server suites on windows, one can at least now start
the broker (bazel run broker) and run the tests that do not start a
background broker process
2022-01-18 13:43:46 +01:00
Luke Bakken 160a74862a
Update link in comment
It is a useful comment, so update all the links to the correct place on the internet:
http://erlang.org/pipermail/erlang-questions/2010-April/050508.html
2021-11-04 15:45:17 -07:00
Philip Kuryloski 8c0eece3cd Adjustments for the latest bazel-erlang 2021-11-02 16:24:26 +01:00
Philip Kuryloski 8f9de08de7 Also assert no missing suites for all other deps 2021-07-12 18:05:55 +02:00
Philip Kuryloski 8c7e7e0656 Revert "Default all `rabbitmq_integration_suite` to flaky in bazel"
This reverts commit 70cb8147b2.
2021-06-23 20:53:14 +02:00
Philip Kuryloski 70cb8147b2 Default all `rabbitmq_integration_suite` to flaky in bazel
Most tests that can start rabbitmq nodes have some chance of
flaking. Rather than chase individual flakes for now, this commit
changes the default (though it can still be overriden, as is the case
for config_scheme_SUITE in many places, since I have yet to see that
particular suite flake).
2021-06-21 16:10:38 +02:00
Loïc Hoguin e20c62486b
Make Web-MQTT obtain/release a FD via file_handle_cache
Makes it behave just like Web-STOMP.
2021-06-02 11:05:32 +02:00
Philip Kuryloski 30f9a95b9f Add dialyze for remaning tier-1 plugins 2021-06-01 10:19:10 +02:00
Philip Kuryloski a6f70b8dda Add xref for remaining tier-1 plugins 2021-05-25 11:39:03 +02:00
Philip Kuryloski e6df6615e1 Futher bazel file refactoring and deduplication 2021-05-11 16:15:33 +02:00
Philip Kuryloski c3f491786f Add rabbitmq_web_mqtt to bazel 2021-05-07 16:25:56 +02:00
Carl Hörberg 681cb78b0d Test that proxy dest address is picked up in all plugins 2021-03-31 11:28:40 +02:00
Philip Kuryloski a63f169fcb Remove duplicate rabbitmq-components.mk and erlang.mk files
Also adjust the references in rabbitmq-components.mk to account for
post monorepo locations
2021-03-22 15:40:19 +01:00
Michael Klishin 5e0d7041cd
Merge pull request #2910 from rabbitmq/configure-num-conns-sup
Make ranch parameter `num_conns_sups` configurable
2021-03-19 21:59:30 +03:00
dcorbacho a41ece3950 Make ranch parameter `num_conns_sups` configurable
Defaults to 1
rabbit - num_conns_sup
rabbitmq_mqtt - num_conns_sup
rabbitmq_stomp - num_conns_sup
2021-03-18 21:38:13 +01:00
kjnilsson 52f745dcde Update rabbitmq-components.mk
use v1.x branch of ra
2021-03-18 15:14:40 +00:00
Loïc Hoguin d5e3bdd623
Add ADDITIONAL_PLUGINS variable
This allows including additional applications or third party
plugins when creating a release, running the broker locally,
or just building from the top-level Makefile.

To include Looking Glass in a release, for example:

$ make package-generic-unix ADDITIONAL_PLUGINS="looking_glass"

A Docker image can then be built using this release and will
contain Looking Glass:

$ make docker-image

Beware macOS users! Applications such as Looking Glass include
NIFs. NIFs must be compiled in the right environment. If you
are building a Docker image then make sure to build the NIF
on Linux! In the two steps above, this corresponds to Step 1.

To run the broker with Looking Glass available:

$ make run-broker ADDITIONAL_PLUGINS="looking_glass"

This commit also moves Looking Glass dependency information
into rabbitmq-components.mk so it is available at all times.
2021-03-12 12:29:28 +01:00
Michael Klishin 2517aec971
Squash a compiler warning introduced in #2878 2021-03-12 10:27:43 +03:00
Michael Klishin 97ff62d3b2
Drop trailing newlines from logged messages where possible
Lager strips trailing newline characters but OTP logger with the default
formatter adds a newline at the end. To avoid unintentional multi-line log
messages we have to revisit most messages logged.

Some log entries are intentionally multiline, others
are printed to stdout directly: newlines are required there
for sensible formatting.
2021-03-11 15:17:37 +01:00
Jean-Sébastien Pédron cdcf602749
Switch from Lager to the new Erlang Logger API for logging
The configuration remains the same for the end-user. The only exception
is the log root directory: it is now set through the `log_root`
application env. variable in `rabbit`. People using the Cuttlefish-based
configuration file are not affected by this exception.

The main change is how the logging facility is configured. It now
happens in `rabbit_prelaunch_logging`. The `rabbit_lager` module is
removed.

The supported outputs remain the same: the console, text files, the
`amq.rabbitmq.log` exchange and syslog.

The message text format slightly changed: the timestamp is more precise
(now to the microsecond) and the level can be abbreviated to always be
4-character long to align all messages and improve readability. Here is
an example:

    2021-03-03 10:22:30.377392+01:00 [dbug] <0.229.0> == Prelaunch DONE ==
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Starting RabbitMQ 3.8.10+115.g071f3fb on Erlang 23.2.5
    2021-03-03 10:22:30.377860+01:00 [info] <0.229.0>  Licensed under the MPL 2.0. Website: https://rabbitmq.com

The example above also shows that multiline messages are supported and
each line is prepended with the same prefix (the timestamp, the level
and the Erlang process PID).

JSON is also supported as a message format and now for any outputs.
Indeed, it is possible to use it with e.g. syslog or the exchange. Here
is an example of a JSON-formatted message sent to syslog:

    Mar  3 11:23:06 localhost rabbitmq-server[27908] <0.229.0> - {"time":"2021-03-03T11:23:06.998466+01:00","level":"notice","msg":"Logging: configured log handlers are now ACTIVE","meta":{"domain":"rabbitmq.prelaunch","file":"src/rabbit_prelaunch_logging.erl","gl":"<0.228.0>","line":311,"mfa":["rabbit_prelaunch_logging","configure_logger",1],"pid":"<0.229.0>"}}

For quick testing, the values accepted by the `$RABBITMQ_LOGS`
environment variables were extended:
  * `-` still means stdout
  * `-stderr` means stderr
  * `syslog:` means syslog on localhost
  * `exchange:` means logging to `amq.rabbitmq.log`

`$RABBITMQ_LOG` was also extended. It now accepts a `+json` modifier (in
addition to the existing `+color` one). With that modifier, messages are
formatted as JSON intead of plain text.

The `rabbitmqctl rotate_logs` command is deprecated. The reason is
Logger does not expose a function to force log rotation. However, it
will detect when a file was rotated by an external tool.

From a developer point of view, the old `rabbit_log*` API remains
supported, though it is now deprecated. It is implemented as regular
modules: there is no `parse_transform` involved anymore.

In the code, it is recommended to use the new Logger macros. For
instance, `?LOG_INFO(Format, Args)`. If possible, messages should be
augmented with some metadata. For instance (note the map after the
message):

    ?LOG_NOTICE("Logging: switching to configured handler(s); following "
                "messages may not be visible in this log output",
                #{domain => ?RMQLOG_DOMAIN_PRELAUNCH}),

Domains in Erlang Logger parlance are the way to categorize messages.
Some predefined domains, matching previous categories, are currently
defined in `rabbit_common/include/logging.hrl` or headers in the
relevant plugins for plugin-specific categories.

At this point, very few messages have been converted from the old
`rabbit_log*` API to the new macros. It can be done gradually when
working on a particular module or logging.

The Erlang builtin console/file handler, `logger_std_h`, has been forked
because it lacks date-based file rotation. The configuration of
date-based rotation is identical to Lager. Once the dust has settled for
this feature, the goal is to submit it upstream for inclusion in Erlang.
The forked module is calld `rabbit_logger_std_h` and is based
`logger_std_h` in Erlang 23.0.
2021-03-11 15:17:36 +01:00
dcorbacho 61f7b2a723 Update to ranch 2.0 2021-03-08 23:11:05 +01:00
Michael Klishin b6c4831e75
Bump Lager to 3.9.1 2021-03-04 04:36:39 +03:00
Loïc Hoguin 66ac1bf5e9
Bump observer_cli to 1.6.1
More responsive when the system is overloaded with file calls.
2021-03-01 21:55:27 +03:00
Michael Klishin 8fe3df9343
Upgrade Lager to 3.9.0 for OTP 24 compatibility
`lager_util:expand_path/1` use changes are
due to erlang-lager/lager#540
2021-02-26 00:52:15 +03:00
Michael Klishin f73e851f9c
Bump observer_cli to 1.6.0 2021-02-24 12:53:55 +03:00
Michael Klishin a5098b28a7
Bump Lager to 3.8.2 for OTP 24 compatibility 2021-02-24 12:53:30 +03:00
Arnaud Cogoluègnes b921ac11a8
Merge pull request #2712 from rabbitmq/rabbitmq-stream-prometheus
Add stream prometheus plugin
2021-01-27 16:46:37 +01:00
Michael Klishin 52479099ec
Bump (c) year 2021-01-22 09:00:14 +03:00
Arnaud Cogoluègnes bf72683eb2
Add stream prometheus plugin 2021-01-11 16:49:56 +01:00
Arnaud Cogoluègnes 23d7e8114c
Introduce stream management plugin 2020-11-19 14:48:25 +01:00
Jean-Sébastien Pédron 47686ee1f0
Remove unused .github directories
They were valid until the switch to the "monorepository" when everything
was merged into a single Git repository.
2020-11-17 13:33:16 +01:00
Arnaud Cogoluègnes 1f21d2815b Update rabbitmq-components.mk 2020-11-03 14:27:52 +01:00
Michael Klishin c7ca91c6f0 Update rabbitmq-components.mk 2020-10-21 12:55:49 +03:00
David Ansari 07ac3ad0f7 Fix typo 2020-08-31 11:30:49 +02:00
Luke Bakken 0f022b85e3 Update rabbitmq-components.mk 2020-08-04 08:41:51 -07:00
Jean-Sébastien Pédron 67f40e0905 Update rabbitmq-components.mk 2020-07-30 12:06:58 +02:00
Luke Bakken 101011cdf2 Update rabbitmq-components.mk 2020-07-29 10:02:07 -07:00
dcorbacho 82fffd452a Update erlang.mk 2020-07-21 14:34:11 +01:00
Michael Klishin b0d92759c9 Update rabbitmq-components.mk 2020-07-21 13:12:57 +03:00
Michael Klishin 8ed22af851 Update rabbitmq-components.mk 2020-07-21 03:43:27 +03:00
dcorbacho 9bda0ac282 Revert drop of Exhibit B on MPL 2.0 2020-07-20 17:05:16 +01:00
Michael Klishin 8fe7698478 Update MPL2 license file, drop Exhibit B
and add a VMware copyright notice.

We did not mean to make this code Incompatible with Secondary Licenses
as defined in [1].

1. https://www.mozilla.org/en-US/MPL/2.0/FAQ/
2020-07-17 14:53:08 +03:00
Michael Klishin 1f000db28d Cosmetics 2020-07-15 03:04:50 +03:00
Michael Klishin f6e77db3d3 Switch to MPL2 2020-07-15 03:02:19 +03:00
Michael Klishin f1f8425103 Extract rabbit_networking:stop_ranch_listener_of_protocol/1
Part of rabbitmq/rabbitmq-server#2321
2020-07-09 22:02:09 +03:00
Michael Klishin d31d88baf0 Close Web MQTT client connections when the node enters maintenance mode
Actually we rely on the MQTT plugin to close MQTT connections,
and only make the WebSocket handler gracefully log such events.

There is no need to close all connections in an internal event handler,
like we do in MQTT or STOMP or Web STOMP plugins. This plugin is
more modern than Web STOMP and some things are not exactly the same.
Nonetheless, we keep functions that list and close connections
around as useful and to keep the delta with Web STOMP smaller.

Part of rabbitmq/rabbitmq-server#2321
2020-07-09 20:57:26 +03:00
Michael Klishin 284a75c04b Unify Ranch ref construction for all listeners
This makes the refs predictable and easy to compute
from a listener record. Then suspending all listeners
becomes a lot simpler.

While at it, make protocol applications clean up
their listeners when they stop. This way tests
and other callers that have to stop the app
would not need to know anything about
its listeners.

Part of rabbitmq/rabbitmq-server#2321
2020-06-24 04:27:34 +03:00
Jean-Sébastien Pédron 6f86131a34 Update erlang.mk 2020-06-23 17:15:56 +02:00
Luke Bakken ebeed7bb10 Stop on errors
Rather than crashing with case_clause, errors returned in the data
handlers should result in the orderly shutdown of the MQTT connection.

Fixes #64
2020-06-17 08:46:09 -07:00
Michael Klishin 5714f7e4a9 Bump Recon to 2.5.1
for Erlang 23 compatibility of 'rabbitmq-diagnostics observer'

References zhongwencool/observer_cli#68.
2020-06-09 08:22:15 +03:00
Jean-Sébastien Pédron 90884e4346 Update copyright (year 2020) 2020-03-10 17:01:22 +01:00
Gerhard Lazu 4fa44da6c4 Update rabbitmq-components.mk 2020-03-06 09:19:22 +00:00
Gerhard Lazu 835b859ae2 Update erlang.mk 2020-03-06 09:18:44 +00:00
Jean-Sébastien Pédron 003a5a00f0 Travis CI: Update config from rabbitmq-common 2020-03-04 14:24:33 +01:00
Jean-Sébastien Pédron 2cba7f316a Travis CI: Update config from rabbitmq-common 2020-03-04 11:17:20 +01:00
Jean-Sébastien Pédron 4361cec35c Travis CI: Update config from rabbitmq-common 2020-03-03 14:53:43 +01:00
Gerhard Lazu 570afad40f Update rabbitmq-components.mk 2020-02-11 15:31:50 +00:00
Michael Klishin d736248cd3 (c) bump 2019-12-29 05:50:38 +03:00
Jean-Sébastien Pédron 3eaa6f13b3 Git: Ignore copied CLI 2019-12-12 15:14:22 +01:00
Jean-Sébastien Pédron 3371a2aa81 Update rabbitmq-components.mk 2019-12-12 13:14:59 +01:00
Michael Klishin b4f51bf2aa Refactor to use ranch:start_listener/5
and avoid a warning from Ranch.

Closes #59.

References rabbitmq/rabbitmq-server#2069.
2019-10-31 15:12:54 +03:00
Luke Bakken cbfd3db0f2 Add GitHub issue and PR templates
Update CONTRIBUTING

Inspired by this message: https://groups.google.com/d/msg/rabbitmq-users/uF05pvy8hk8/iUiVxHr6AQAJ
2019-10-30 08:40:18 -07:00
kjnilsson fa7c23911e Update rabbitmq-components.mk 2019-09-13 10:24:38 +01:00
kjnilsson a9d684288c Update rabbitmq-components.mk 2019-09-04 10:31:15 +01:00
Jean-Sébastien Pédron 02e9ace788 Update erlang.mk 2019-08-29 20:46:12 +02:00
Michael Klishin f1f75c1d55 Update rabbitmq-components.mk 2019-08-11 01:48:13 +10:00
Jean-Sébastien Pédron fe891b9546 Update erlang.mk 2019-08-02 09:55:03 +02:00
Michael Klishin e0a326af6c Update rabbitmq-components.mk 2019-08-01 17:13:34 +03:00
Michael Klishin e7b3b5618e RabbitMQ 3.6.x has long been out of support 2019-07-09 20:00:40 +03:00
Michael Klishin 0a1ed6842a README edits to match rabbitmq-web-stomp 2019-07-09 19:59:51 +03:00
Arnaud Cogoluègnes 3a7642509b Update rabbitmq-components.mk 2019-07-09 16:06:16 +02:00
Jean-Sébastien Pédron f2bf3aaa9d Update rabbitmq-components.mk 2019-06-28 16:05:45 +02:00
Jean-Sébastien Pédron 25d2464ada Update erlang.mk 2019-06-28 16:03:12 +02:00
Arnaud Cogoluègnes 6037931ac5 Add connection info module
To extract client ID at authentication time.

[#166271318]

References #1767
2019-06-14 14:26:23 +02:00
Michael Klishin 38160e0c76 Don't include max_connections into socket options
It is rejected as an unsupported value.
Use Ranch transport options directly instead.

References #28.
Closes #55.
2019-06-07 12:22:08 +03:00
Michael Klishin f5b9436a5d Make sure web_mqtt.tcp.max_connections accepts 'infinity' as value 2019-06-07 09:43:57 +03:00
Michael Klishin 90c72a7bec Default max_connections to infinity
References #28.
Closes #55.
2019-06-07 09:39:30 +03:00
Michael Klishin 84430e557b Make web_mqtt.tcp.max_connections configurable via ini-style config file
References #28, #55.
2019-06-07 09:38:13 +03:00
Gerhard Lazu f22caf237a Update rabbitmq-components.mk 2019-06-03 02:23:51 +01:00
Jean-Sébastien Pédron f1f7a5fb27 Update rabbitmq-components.mk 2019-05-17 15:21:52 +02:00
Michael Klishin f8e48fc648 Update rabbitmq-components.mk 2019-05-17 08:37:29 +03:00
Michael Klishin 085f6616e6 Update rabbitmq-components.mk 2019-05-14 11:51:13 +03:00
Michael Klishin 368dca1609 Update rabbitmq-components.mk 2019-05-13 16:40:52 +03:00
Gerhard Lazu 8de958de94 Update rabbitmq-components.mk 2019-05-01 13:18:30 +01:00
Luke Bakken 2d60e1b035 Update rabbitmq-components.mk 2019-04-30 16:21:07 -07:00
Jean-Sébastien Pédron c1c8eb1d7d Update rabbitmq-components.mk 2019-04-30 14:47:43 +02:00
Gerhard Lazu bf9bbf0d77 Update rabbitmq-components.mk 2019-04-22 21:55:20 +01:00
Spring Operator b443fa10a6 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* http://blog.listincomprehension.com/search/label/procket (200) with 1 occurrences could not be migrated:
   ([https](https://blog.listincomprehension.com/search/label/procket) result ClosedChannelException).
* http://dozzie.jarowit.net/trac/wiki/TOML (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/TOML) result SSLHandshakeException).
* http://dozzie.jarowit.net/trac/wiki/subproc (200) with 1 occurrences could not be migrated:
   ([https](https://dozzie.jarowit.net/trac/wiki/subproc) result SSLHandshakeException).
* http://e2project.org (200) with 1 occurrences could not be migrated:
   ([https](https://e2project.org) result AnnotatedConnectException).
* http://erlang.2086793.n4.nabble.com/initializing-library-applications-without-processes-td2094473.html (200) with 1 occurrences could not be migrated:
   ([https](https://erlang.2086793.n4.nabble.com/initializing-library-applications-without-processes-td2094473.html) result SSLHandshakeException).
* http://nitrogenproject.com/ (200) with 2 occurrences could not be migrated:
   ([https](https://nitrogenproject.com/) result ConnectTimeoutException).
* http://proper.softlab.ntua.gr (200) with 1 occurrences could not be migrated:
   ([https](https://proper.softlab.ntua.gr) result SSLHandshakeException).
* http://yaws.hyber.org (200) with 1 occurrences could not be migrated:
   ([https](https://yaws.hyber.org) result AnnotatedConnectException).
* http://choven.ca (503) with 1 occurrences could not be migrated:
   ([https](https://choven.ca) result ConnectTimeoutException).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* http://fixprotocol.org/ (301) with 1 occurrences migrated to:
  https://fixtrading.org ([https](https://fixprotocol.org/) result SSLHandshakeException).
* http://erldb.org (UnknownHostException) with 1 occurrences migrated to:
  https://erldb.org ([https](https://erldb.org) result UnknownHostException).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* http://cloudi.org/ with 27 occurrences migrated to:
  https://cloudi.org/ ([https](https://cloudi.org/) result 200).
* http://erlware.org/ with 1 occurrences migrated to:
  https://erlware.org/ ([https](https://erlware.org/) result 200).
* http://inaka.github.io/cowboy-trails/ with 1 occurrences migrated to:
  https://inaka.github.io/cowboy-trails/ ([https](https://inaka.github.io/cowboy-trails/) result 200).
* http://ninenines.eu with 6 occurrences migrated to:
  https://ninenines.eu ([https](https://ninenines.eu) result 200).
* http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html with 1 occurrences migrated to:
  https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html ([https](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) result 200).
* http://www.actordb.com/ with 2 occurrences migrated to:
  https://www.actordb.com/ ([https](https://www.actordb.com/) result 200).
* http://www.cs.kent.ac.uk/projects/wrangler/Home.html with 1 occurrences migrated to:
  https://www.cs.kent.ac.uk/projects/wrangler/Home.html ([https](https://www.cs.kent.ac.uk/projects/wrangler/Home.html) result 200).
* http://www.rabbitmq.com/community-plugins.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/community-plugins.html ([https](https://www.rabbitmq.com/community-plugins.html) result 200).
* http://www.rabbitmq.com/plugin-development.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/plugin-development.html ([https](https://www.rabbitmq.com/plugin-development.html) result 200).
* http://www.rabbitmq.com/plugins.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/plugins.html ([https](https://www.rabbitmq.com/plugins.html) result 200).
* http://www.rabbitmq.com/web-mqtt.html with 1 occurrences migrated to:
  https://www.rabbitmq.com/web-mqtt.html ([https](https://www.rabbitmq.com/web-mqtt.html) result 200).
* http://www.rebar3.org with 1 occurrences migrated to:
  https://www.rebar3.org ([https](https://www.rebar3.org) result 200).
* http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* http://inaka.github.com/apns4erl with 1 occurrences migrated to:
  https://inaka.github.com/apns4erl ([https](https://inaka.github.com/apns4erl) result 301).
* http://inaka.github.com/edis/ with 1 occurrences migrated to:
  https://inaka.github.com/edis/ ([https](https://inaka.github.com/edis/) result 301).
* http://lasp-lang.org/ with 1 occurrences migrated to:
  https://lasp-lang.org/ ([https](https://lasp-lang.org/) result 301).
* http://saleyn.github.com/erlexec with 1 occurrences migrated to:
  https://saleyn.github.com/erlexec ([https](https://saleyn.github.com/erlexec) result 301).
* http://www.mozilla.org/MPL/ with 10 occurrences migrated to:
  https://www.mozilla.org/MPL/ ([https](https://www.mozilla.org/MPL/) result 301).
* http://zhongwencool.github.io/observer_cli with 1 occurrences migrated to:
  https://zhongwencool.github.io/observer_cli ([https](https://zhongwencool.github.io/observer_cli) result 301).
2019-03-20 03:25:32 -05:00
Michael Klishin 20718881d1 Travis: use Erlang 21.3, Elixir 1.8.1 2019-03-20 10:33:22 +03:00
Michael Klishin e0582a5a05 Update rabbitmq-components.mk 2019-03-15 09:34:56 +03:00
Michael Klishin c72f4bbd3f Update rabbitmq-components.mk 2019-03-15 05:06:04 +03:00
Michael Klishin 528c1f87c8 Update rabbitmq-components.mk 2019-02-12 23:24:15 +03:00
Michael Klishin 21817b733d .travis.yml: use 21.2 as 21.2.2 builds are no available 2019-01-14 01:20:29 +03:00
Michael Klishin 3431ddded5 .travis.yml: sync Erlang and Elixir versions, require Erlang/OTP 21.2 2019-01-13 05:50:08 +03:00
Luke Bakken d903da9dac Update rabbitmq-components.mk 2019-01-09 12:55:28 -08:00
Luke Bakken 3d6bb5d4b4 Update rabbitmq-components.mk 2019-01-08 11:58:38 -08:00
Luke Bakken 5ac293267b Reverse order of ciphers in generated file to ensure they match rabbitmq.conf. The ct helpers will not verify this as the snippets and results are deep sorted 2018-12-31 11:59:36 -08:00
Luke Bakken f17eff13f7 Modify test so generated ciphers are in the expected order 2018-12-31 11:59:06 -08:00
Michael Klishin ac867ef45d Remove debug tracing 2018-12-18 05:02:01 +03:00
Michael Klishin ec5e78563b Lower the timeout since it's expected here 2018-12-18 04:30:25 +03:00
Michael Klishin ac4ffa5f4c Squash a warning 2018-12-18 04:23:27 +03:00
Michael Klishin 4cbeaf0e73 Integration tests for #52
[#162720877]
2018-12-18 04:03:07 +03:00
Michael Klishin dc81d674f7 Last Will is now sent in terminate/2 2018-12-18 04:00:05 +03:00
Karen Mae Bajador c6c8b83594 Send will on client's ungraceful disconnect 2018-12-17 14:31:26 +11:00
Luke Bakken 9c37888edd Fix port in schema
Follow-up to #50
2018-12-12 07:14:24 -08:00