Commit Graph

1479 Commits

Author SHA1 Message Date
tigercl da755b88c7 Add monitors and alarm handler (#2266)
* Add monitors and alarm handler
2019-02-28 18:25:17 +08:00
turtled f1d751dd95 Fix compile fail 2019-02-28 17:06:40 +08:00
Gilbert b1ca0120a2 Move bridge modules out of bridge directory (#2273) 2019-02-28 17:04:39 +08:00
turtled c8e2840126 Merge fix conflicts 2019-02-28 17:02:39 +08:00
turtled 42932d7b5d Format code 2019-02-28 16:57:40 +08:00
turtled df97eb0007 Review code 2019-02-28 16:56:44 +08:00
turtled 8792f7e02b Review code 2019-02-28 16:56:04 +08:00
linjun 814fd3fc9e Fix test case 2019-02-28 16:36:47 +08:00
Gilbert Wong 055d0ad98e Fix typo 2019-02-28 15:39:11 +08:00
Gilbert Wong 7efd7b3ec0 Rename portal to bridge 2019-02-28 15:31:54 +08:00
Gilbert 771f8c052a
Merge branch 'develop' into introduce-new-bridge-impl 2019-02-28 15:14:40 +08:00
Feng Lee 3e0fa87209 Remove the io:format 2019-02-28 15:09:13 +08:00
Feng Lee e3bc8e4f0a Support batch delivery
- Upgrade the emqx_session module to support batch delivery
- Update emqx_protocol:deliver/2 to support batch delivery
- Update some test cases
2019-02-28 15:09:13 +08:00
Feng Lee 08204fc7a8 Improve the emqx_connection module using gen_statem behaviour (#2235) 2019-02-28 15:08:29 +08:00
linjun 16165ce935 Use conn_mod instead of socktype 2019-02-28 11:32:05 +08:00
Gilbert Wong d18f4ba550 Fix wrong config entries 2019-02-28 11:18:12 +08:00
Gilbert Wong 911a813891 Fix copyright and unify log method 2019-02-28 11:18:12 +08:00
spring2maz 9dbc34c376 Ack replayq and allow retry in tests 2019-02-28 11:17:27 +08:00
Gilbert Wong 75163e21f3 Reverse intensity/period in bridge SupFlag 2019-02-28 11:17:27 +08:00
Gilbert Wong ae92acf30f Refactor portal supervisor 2019-02-28 11:17:27 +08:00
Gilbert Wong ec37225333 Add emqx_portal interfaces 2019-02-28 11:17:27 +08:00
Gilbert Wong 921a45a505 Fix emqx_portal_mqtt_tests start function 2019-02-28 11:17:27 +08:00
spring2maz d4495fd8e7 Add manual start API 2019-02-28 11:17:27 +08:00
spring2maz 1626cade28 Deleted batch publish support in emqx_portal_client
eqmx_portal_mqtt has to do single message publish calls for now
Also fix a bug in emqx_portal_mqtt ack collector
2019-02-28 11:17:27 +08:00
spring2maz 086a1d56b9 Drop unused config schema
bridge.$name.transport was added before we decided to derive
transport portocol based on the 'address' config.
i.e. when it's a remote erlang node, use gen_rpc
otherwise (must be IP or hostnmae), we should estabilish mqtt connection
2019-02-28 11:17:27 +08:00
spring2maz efc9e34033 Make use of BUMP_PACKET_ID the only way to generate packet IDs 2019-02-28 11:17:27 +08:00
Gilbert Wong d7e18c95c6 Fix spelling error 2019-02-28 11:17:27 +08:00
spring2maz 786a6eb696 Add APIs for subscription add / delete 2019-02-28 11:17:27 +08:00
spring2maz 599f5c8d4f Add API emqx_portal:ensure_forward_absent 2019-02-28 11:17:27 +08:00
spring2maz 2903a810ce Add emqx_portal:ensure_foreard_present API 2019-02-28 11:17:27 +08:00
spring2maz 9e78c18681 Add get_forwards and get_subscriptions protal APIs 2019-02-28 11:17:27 +08:00
spring2maz 67376727c9 Add batch send support for emqx_client:publish/2
also cover emqx_portal_mqtt with CT
2019-02-28 11:17:27 +08:00
spring2maz b9e8bde3b0 Add first CT test for emqx_portal based on rpc 2019-02-28 11:17:27 +08:00
spring2maz 6d51d78dfc Add portal transport over emqx_client. 2019-02-28 11:17:27 +08:00
spring2maz 141af0d02c Add message handler callbacks option to emqx_client
In this commit, msg_handler option is added to emqx_client.
so the caller can provide callbacks to handle puback, publish,
as well as disconnected events instead of always delivered
as message like Owner ! {publish, Msg} to the owner process.

This is to make it ready to implement emqx_portal_connect on
top of emqx_client.
2019-02-28 11:17:27 +08:00
spring2maz fbe67e6784 Introduce new bridge impl 2019-02-28 11:17:27 +08:00
Gilbert c3e6f3c3b2 Improve try catch syntax (#2263)
* Replace case catch.. with try ... catch
Prior to this change, case catch ... would cost a lot of performance
because it would retrieve the whole stacktrace. However, try...catch
will not retrieve the whole stacktrace. So try...catch syntax is better.
2019-02-28 09:54:28 +08:00
linjun 44529a278d Adjusting code 2019-02-27 14:39:49 +08:00
linjun e1a5188d09 Adjusting code 2019-02-27 14:00:11 +08:00
linjun 7af6051e25 Refactor code 2019-02-27 13:54:24 +08:00
linjun 760ac9f2f9 Add the value of attribute socktype in emqx_conn_type table 2019-02-27 11:09:45 +08:00
Feng Lee c8b243ed22 Change some '-type' attrs to '-opaque' and improve emqx_gc, emqx_inflight modules
- Define 'GCS(St)' macro to improve emqx_gc module
- Define 'Inflight(MaxSize, Tree)' macro to improve emqx_inflight module
2019-02-22 18:08:13 +08:00
Feng Lee 565c1a8c85 Optimize unset_flag/2 and add some specs
- Optimize unset_flag/2
- Add some function specs
- Add emqx_message_SUITE to Makefile
2019-02-22 17:06:52 +08:00
Feng Lee 82c337a040 Fix 'drpped' typo
- Fix 'drpped' typo
- Add specs for exported functions
- Add 'group()' type in emqx_topic module
2019-02-22 10:03:29 +08:00
Feng Lee 7a645dd9cc Add 'include/types.hrl' and introduce some common types 2019-02-19 17:16:11 +08:00
张奇怪 44d3eff094 Auto-pull-request-by-2019-02-19 (#2232)
* Update Copyright to 2019 (#2191)

* Disable bridges by default (#2189)

* Fix warning logger args emqx#2195

* Ambiguity elimination (#2217)

* Fix emqx_ws_connection: prevent crashes on pong (#2210)

* Issue#2184 (#2194)

* Delete dep-vsn-check

* Format app.src
2019-02-19 14:00:34 +08:00
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
turtleDeng 00863acea3
Merge emqx30 (#2181)
* Change the reason code in will topic acl check (#2168)

* Fix bridge bug (#2160)

* Limit bridge QoS less than 1

* Improve shared sub dispatch implementation. (#2144)

* Upgrade ekka, esockd libraries

* Improve the 'try_open_session' function

* Reload config (#2180)
2019-01-25 13:01:48 +08:00
Shawn b8929a46c1 Fix the EXIT outputs in Travis CI (#2154)
* Fix the Exit in testcases

* Fix Exit in emqx_mod_sup_SUITE

* Update testcases for log_tracer

* Fix Exit in emqx_protocol_SUITE

* Add will_acl_check

* Fix more Exits
2019-01-17 17:14:51 +08:00
tigercl bc31faac6b Fix will msg (#2156)
* Remove will_msg and will_topic from protocol state

* Modify try_open_session/1
2019-01-17 13:57:42 +08:00
Gilbert Wong ec03f8e1fa Fix the deliver packet bug and add test case 2019-01-11 16:41:20 +08:00
turtleDeng a5f9466040 QoS0 msg support msgid (#2145)
* QoS0 msg support msgid

* Fix testcase
2019-01-11 11:47:10 +08:00
Feng Lee 5ccaaed34c Add 'next_events/1' and fix the 'process_incoming/3' function 2019-01-10 09:23:05 +08:00
Feng Lee 3e15ac0bbb Improve the design of 'emqx_client' module
Use '{next_event, cast, Packet}' to replace 'gen_statem:cast/2'
2019-01-10 09:23:05 +08:00
Feng Lee 30f32de13a Use map to replace 'state' record 2019-01-10 08:53:10 +08:00
Feng Lee e882af9369 Use the new logger macros 2019-01-10 08:53:10 +08:00
Feng Lee fe0f5333b3 Improve the pool design
- Move 'emqx_pool:start_link/0' to emqx_pool_sup module
- Use the new log macros
- Add more test cases
2019-01-10 08:49:58 +08:00
Feng Lee 4230a3c535 Optimize the trie match 2019-01-09 11:57:22 +08:00
Feng Lee 0c418581b2 Add emqx_trie:empty/0 and optimize match_routes/1 2019-01-09 11:57:22 +08:00
Gilbert dee88fb018 Fix mem cache bug (#2129) 2019-01-07 14:15:27 +08:00
Shawn 0d9929fdaa Logger level in one command (#2115)
* Refactor logger-level-in-one-command

* Update API
2019-01-07 11:40:54 +08:00
Shawn cb93a356a0 Fix crash if peer closed the connection (#2120)
Prior to this fix, we'll get the following crash if we connected to
another emqx broker but got refused because of wrong username or password.
2019-01-07 11:40:05 +08:00
Feng Lee d7254cdc7f Add more macros for logger 2019-01-04 17:30:27 +08:00
terry-xiaoyu 3b8eb41347 Remove the log header macro 2019-01-04 17:30:27 +08:00
Shawn 69954480bf
Hook args (#2119) 2019-01-03 13:54:31 +08:00
YoukiLin 78b3c375d8
Improving 'emqx_ws_connection' coverage (#2107) 2019-01-03 12:59:39 +08:00
Gilbert 9a2573d54b Refactor bridge (#2117)
* Refactor bridge
2019-01-03 09:10:43 +08:00
Gilbert 72791b569e
Improve app src (#2114)
* Add replayq in emqx.app.src

* Fix publish_readq_msg badmatch
2018-12-28 20:04:52 +08:00
Gilbert Wong eed03ee297 Add replayq in emqx.app.src 2018-12-28 19:53:58 +08:00
turtleDeng 6a1ebe299a
Merge emqx32 to emqx30 (#2112) 2018-12-28 19:44:41 +08:00
Shawn d854120023
Show plugin name if cannot start it (#2111) 2018-12-28 16:37:01 +08:00
Gilbert 1797aadbe7 Fix unsuback compat (#2102) 2018-12-22 18:47:38 +08:00
tigercl edf0ded9f3 Fix bug that no update message expiry interval (#2101) 2018-12-22 11:32:22 +08:00
turtled f7596b8131 Fix session shutdown bug 2018-12-21 22:44:58 +08:00
Feng Lee bb45825e77 Inc deliver_stats, enqueue_stats with emqx_pd:update_counter/2 (#2100) 2018-12-21 18:31:04 +08:00
turtled 6f4d517350 Fix conflicts 2018-12-21 17:55:25 +08:00
Feng Lee f31e7f8bde Replace put/2 with emqx_pd:update_counter/2 (#2098) 2018-12-21 17:47:49 +08:00
turtled 7d3357e0f3 Merge emqx32 2018-12-21 16:01:32 +08:00
YoukiLin e949e8cbd8 Add format output for test print (#2076)
* Add formatted output for the test print
2018-12-21 15:42:42 +08:00
Feng Lee 10e5210581 Workaround ssl:setopts(SslSock, [{active, N}]) (#2095)
* Set '{active, true}' for SSL socket
2018-12-21 15:39:24 +08:00
tigercl 31bf01fd7a Fix bug in topic alias maximum (#2074)
* Fix bug in topic alias maximum
2018-12-21 14:01:21 +08:00
Feng Lee 3fec9cdf0a Try to simulate a '{ssl_passive, Sock}' message:( 2018-12-21 12:03:40 +08:00
turtleDeng 4f84a31d02
Update copyright (#2093) 2018-12-21 11:06:50 +08:00
Gilbert bf7f10ecd1 Add will topic validation and acl check (#2075)
* Add will topic validation and acl check
2018-12-21 10:49:03 +08:00
Feng Lee 367b717c40 Implement a new 'emqx_gc' module (#2090)
Update connection/session module to using the new emqx_gc API
2018-12-20 22:42:18 +08:00
turtled b4833d6973 Fixed conflicts 2018-12-20 22:23:20 +08:00
tigercl 938d30268a Remove extra case...of (#2082)
* Remove extra case...of
2018-12-20 21:42:14 +08:00
YoukiLin 6b538d2363 Add test cases for 'emqx_cm' and 'emqx_sm' (#2073)
Add test cases for 'emqx_cm' and 'emqx_cn'
2018-12-20 21:03:40 +08:00
Feng Lee 14cffcf7fb Add the 'emqx_pd' module
Add utility functions for erlang process dictionary
Add test cases for emqx_pd
2018-12-20 16:45:25 +08:00
Feng Lee 14a12e0c6c Move the 'LOG_HEADER' macro above '-include(logger.hrl)' 2018-12-20 14:45:52 +08:00
Feng Lee 6e1b47f1f9 Improve the emqx_connection module
Rename 'publish_limit' to 'pub_limit'
'try ... of ... catch' to replace 'case catch'
2018-12-20 14:45:52 +08:00
Feng Lee d827604213 Remove the ensure_stats_timer/1 call from reply/2 and noreply/1 2018-12-20 11:33:18 +08:00
Feng Lee 42fc8f5811 Improve the session module 2018-12-20 10:21:40 +08:00
tigercl 97474171d0 Better report errors in acl.conf (#2065) 2018-12-19 23:06:48 +08:00
turtled 7a1ec580b0 Update broker test cases 2018-12-19 17:18:26 +08:00
Feng Lee 892d9439b9 Implement a new session supervisor. (#2077) 2018-12-19 16:49:35 +08:00
Gilbert 7d9e350bbe Add option to disconnect client in case acl deny (#2059)
* Add option to disconnect client in case acl deny
2018-12-19 10:34:06 +08:00
turtled 666d9706a3 Fixed conflicts 2018-12-18 16:41:10 +08:00
turtled 1e2c5db36c Modify batch size 2018-12-18 15:42:54 +08:00
Feng Lee dc06c0beab Remove 'topic_alias_maximum' from session's state 2018-12-18 15:11:04 +08:00
tigercl 95ad67b47c Fix a bug that will not send a will message in some cases (#2068)
* Fix a bug that will not send a will message in some cases
2018-12-18 14:55:37 +08:00
周子博 b7a39f25f2 Revert "Fix a bug that will not send a will message in some cases"
This reverts commit 675edf3fab.
2018-12-18 12:02:18 +08:00
周子博 675edf3fab Fix a bug that will not send a will message in some cases 2018-12-18 12:01:41 +08:00
Feng Lee 721b72b96a Add 'active_n' option to optimize the CPU usage of emqx_connection (#2060)
* Add 'active_n' option to optimize the CPU usage of emqx_connection

* Supports batch processing 'DOWN' events
2018-12-17 19:53:29 +08:00
turtled f54d414825 Fix pick fail 2018-12-15 13:42:07 +08:00
turtled 34370ef622 Merge branch 'issue#1983' into emqx30 2018-12-14 17:55:36 +08:00
Feng Lee abe9aff062 Add 'enable_session_registry' config 2018-12-13 18:28:32 +08:00
Feng Lee 7fe3d59c28 Update the registered name of pool sup. 2018-12-13 17:54:22 +08:00
Feng Lee 4aaf0a7db4 Remove emqx_session_sup to handle massive concurrent sessions 2018-12-13 17:10:02 +08:00
Feng Lee 4e1d1bd60f Remove the emqx_session_sup module 2018-12-13 17:10:02 +08:00
Feng Lee a68e3f265d Fix 'badarg' crash 2018-12-12 16:34:55 +08:00
Feng Lee d8cbf72da1 Fix 'badarg' crash 2018-12-12 16:32:58 +08:00
Feng Lee 8f2f4b6b81 Optimize connection and session management 2018-12-12 16:21:30 +08:00
Feng Lee 8d50c62a94 Optimize connection and session management 2018-12-12 16:10:16 +08:00
Feng Lee 99872b253f Fix 'function not exported' crash 2018-12-12 14:53:22 +08:00
Feng Lee 2a747c9d53 Improve the subscription sharding. 2018-12-12 13:40:01 +08:00
Feng Lee 33830d8120 Improve the design of trie, router and broker modules
1. Add do_add_route/1 do_add_route/2, do_delete_route/1,
do_delete_route/2 APIs in emqx_router module
2. Improve the code of emqx_trie module
3. Update the emqx_broker module to call the new APIs of emqx_router
2018-12-12 13:40:01 +08:00
Feng Lee 47e3cd3692 Improve the subscription sharding. 2018-12-12 13:34:13 +08:00
Feng Lee cca5081e02 Improve the design of trie, router and broker modules
1. Add do_add_route/1 do_add_route/2, do_delete_route/1,
do_delete_route/2 APIs in emqx_router module
2. Improve the code of emqx_trie module
3. Update the emqx_broker module to call the new APIs of emqx_router
2018-12-10 18:37:42 +08:00
周子博 ec2e289776 Fix crash in emqx_acl_internal:filter/2 2018-12-10 11:13:25 +08:00
Feng Lee fb7b63c59b
Merge branch 'emqx32' into subscription-sharding 2018-12-10 10:08:18 +08:00
Gilbert Wong e0eb76afa6 Fix subscription 2018-12-08 16:09:54 +08:00
Feng Lee 64f62fa0ce Make some processes hibernate after 1s. 2018-12-08 15:03:34 +08:00
Feng Lee f008ceb5c8 Optimize the route and trie modules.
1. Use mnesia:wread/1 to replace mnesia:read/2
2. Update the router supervisor
2018-12-08 15:03:34 +08:00
Gilbert 0b70896456 Fix the coverage shaky (#2010) 2018-12-08 15:03:34 +08:00
spring2maz b6c123b173 Use git tag for app vsn 2018-12-08 15:03:34 +08:00
turtled 5164d0d6a5 Fix unsubscribe fail and rename shared -> shard 2018-12-08 11:40:08 +08:00
turtled d1be51d398 Format code 2018-12-08 10:52:15 +08:00
turtled ba897e51f9 Subscriber down clear emqx_suboption table 2018-12-08 10:26:50 +08:00
turtled 5e53eaeee5 rename shard shared 2018-12-08 09:56:00 +08:00
Feng Lee 36e7d63d66 Implement subscription sharding.
1. Improve the design router, broker and shared_sub
2. New ets tables' design for subscription sharding
2018-12-07 18:20:09 +08:00
Feng Lee bce1ddc5c4 Implement a hash-based subscription sharding 2018-12-06 18:45:07 +08:00
Feng Lee d11e734dae Make some processes hibernate after 1s. 2018-12-05 10:31:11 +08:00
周子博 35e699e54e Make sure test case of emqx_banned passes 2018-12-04 16:11:25 +08:00
Feng Lee b4d981daf2 Add a sequence module to generate index for subscription sharding 2018-12-04 15:59:24 +08:00
周子博 b2c3d8366d Add logs for malformed acl configuration file 2018-12-03 13:57:37 +08:00
Feng Lee 95446ca837 Optimize the route and trie modules.
1. Use mnesia:wread/1 to replace mnesia:read/2
2. Update the router supervisor
2018-12-03 11:10:47 +08:00
Gilbert 295a9d692e
Fix the coverage shaky (#2010) 2018-11-30 19:16:48 +08:00
spring2maz 14dfe03426 Use git tag for app vsn 2018-11-30 11:03:26 +01:00
Feng Lee d9470f365f Optimize read/write concurrency of mnesia/ets tables 2018-11-30 17:46:15 +08:00
Feng Lee e15e5d1f98 Fix the atom leaks in emqx_reason_codes module. 2018-11-30 17:45:28 +08:00
周子博 fde5fbe73a Align the code 2018-11-30 17:44:29 +08:00
周子博 ad8b547519 Make batch committing of metrics more elegant 2018-11-30 17:44:29 +08:00
周子博 f315994eb9 Remove unnecessary spec 2018-11-30 17:44:29 +08:00
周子博 c87aabbbeb Some forgotten changes in last commit 2018-11-30 17:44:29 +08:00
周子博 ea62b15c87 Alter apis provided by emqx_metrics, and use existing timer to commit metrics 2018-11-30 17:44:29 +08:00
周子博 194dbc02c8 Add batch commit for metrics 2018-11-30 17:44:29 +08:00
Feng Lee 21ed012a0c Add an elegant batch module 2018-11-29 10:13:09 +08:00
Feng Lee 309f3560f3 Bump version to 3.0.0 2018-11-28 16:05:17 +08:00
周子博 5c291ff23e Fix the 'route_batch_delete' config 2018-11-28 16:04:04 +08:00