Commit Graph

181 Commits

Author SHA1 Message Date
Feng Lee 8d50c62a94 Optimize connection and session management 2018-12-12 16:10:16 +08:00
Feng Lee bce1ddc5c4 Implement a hash-based subscription sharding 2018-12-06 18:45:07 +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
Shawn eeb0cab3e3 Update proc meta-data for empty clientid (#1980) 2018-11-23 18:11:46 +08:00
spring2maz a2c658ba19 Add acking mechamism for shared dispatch (#1872)
* Add acking mechamism for shared dispatch

For QoS0 messages, no acking
For QoS1/2 messages, 'ACK' at any of events below:
 - ACK when QoS is downgraded to 0
 - Message is sent to connection process
'NACK' at any of events below:
 - Message queue is full and the receiving session starts to drop old messages
 - The receiving session crash
Upon 'NACK', messages are dispatched to the 'next' subscriber in the group,
depending on the shared subscription dispatch strategy.
2018-11-21 22:49:45 +08:00
Gilbert 16821490ce Fix issue#1874 (#1964)
* Fix issue#1874
Prior to this change, if user use one client connect emqx with mqtt
v3.1.1, the client subscribe the topic and publish message to this
topic, it would receive this message itself published, this commit
provide a configure option to let user ignore the message itself published.

This change fix issue 1874.

* Small Fix

* Fix bug

* Better design

* Fix compile warning and improve coverage

* Better design to solve the performance issue

* Fix typo

* Fix typo

* Delete spaces in end of lines.

* Do not use anonymous function

* Better performance
2018-11-19 13:34:03 +08:00
turtled faeda253e1 Fix conflicts 2018-11-10 11:44:55 +08:00
Gilbert Wong 32d3826440 Replace macro QOS$i to QOS_$I
The two styles of qos macro name in one project is chaotic. It is not
a good practice.

So I change the QOS$i to QOS_$i
2018-11-08 20:42:31 +08:00
terry-xiaoyu 94dbdffd59 New logger formatter with meta-data 2018-11-02 18:38:07 +08:00
spring2maz ae743ad1f0 Rewrite emqx_mqueue.erl
Fixed bugs:

- Priority queue lack of a `len + 1` logic in `in/2`

Changed behaviors:

- Topics not found in priority table (from config) will be treated with default priority,
  instead of hasing topic name to a priority number.
- Default priority is now configurable (it was always lower than all configured priorities)
- The dropped message due to reaching `max_len` is now returned from `in/2`,
  so the queue owner (`in/2` caller) can perform autopsy on it
2018-10-27 14:21:53 +02:00
周子博 3cea06f88f Remove resume_session/1, 2018-10-27 14:25:10 +08:00
周子博 7c14ba11d6 Set some attributes when session resumed 2018-10-27 13:59:17 +08:00
周子博 92251d4a8a Make more normalize 2018-10-26 17:45:13 +08:00
周子博 db2e47470a Fix bugs 2018-10-25 16:19:57 +08:00
周子博 6675e3d496 Implement will message delay publish in session, add test case for clean start and will message in connect packet 2018-10-25 14:26:31 +08:00
周子博 29beb42aa2 Using client id rather then session pid 2018-10-10 14:00:17 +08:00
周子博 9bcd4c3e08 improve will message 2018-10-09 13:35:27 +08:00
spring2maz e3f2ae8db8 Change from customized total heap size check to set process flag
The `max_heap_size` process flag can be used to limit total
heap size of a process, and it gives much more detailed
crash log if the limit is hit.
2018-09-29 21:36:34 +08:00
周子博 1705f25db6 Fix bug in session expiry interval 2018-09-29 21:30:22 +08:00
周子博 2d354ca883 Improve topic alias maximum in connect packet 2018-09-29 14:47:21 +08:00
周子博 064db65206 improve receive maximum in connect packet 2018-09-29 14:47:21 +08:00
HuangDan 96b5d71a67 Fix args errors on emqx_hook:run('message.acked') 2018-09-27 11:49:23 +08:00
tigercl 03f607c1b2 Fix issue#1833 and #1834 (#1845) 2018-09-22 16:10:24 +08:00
spring2maz b61615323b Move shutdown policy config to zone configs 2018-09-21 18:58:18 +02:00
spring2maz 6fca651a84 Add connection/session shutdown policy
The hibernation behaviour is also changed (implicitly) in this commit:
Prior to this change, connection/session always hibernates after
the stats timer expires regardless of messages in mailbox.
After this commit, connection/session process only goes to hibernate
when the timer expires AND there is nothing left in the mailbox to
process
2018-09-21 18:58:18 +02:00
spring2maz 721f237bc4 Rewrite emqx_gc.erl
The implementation prior to this commit supports
only one gc enforcement policy which is message count threshold.
The new implementation introduces 1 more: volume threshold based
2018-09-21 22:56:34 +08:00
terry-xiaoyu 389b3c80bc Fix the message delivery to remote 2018-09-21 20:00:43 +08:00
周子博 3caa41f751 Add run hook when duplicated subscription 2018-09-08 19:01:03 +08:00
周子博 40977e529a Retain flag in retained message must set to 1 2018-09-08 18:31:44 +08:00
周子博 f8471afb97 Add handling of retain handling subscription option 2018-09-07 13:50:12 +08:00
周子博 47955f4309 fix bug in retain as published flag 2018-09-05 15:18:26 +08:00
周子博 aa34258f1e Support Retain As Published in Subscription Options 2018-09-05 14:25:33 +08:00
terry-xiaoyu 3f42f1271b bug fix 2018-08-31 18:14:10 +08:00
Feng Lee ea1ae70833 Fix errors found by dialyzer 2018-08-31 16:46:51 +08:00
Feng Lee 0379219a04 Improve the design of session discard 2018-08-30 23:14:09 +08:00
Feng Lee 78a8ccd0f2 Only store packet_id and timestamp for qos2 message 2018-08-30 21:17:20 +08:00
Feng Lee 826daace61 Align the state record 2018-08-30 18:44:58 +08:00
Feng Lee c49e5dfddc
Merge branch 'emqx30' into emqx30-feng 2018-08-30 18:42:29 +08:00
Feng Lee 7b5f2577d3 Support message ttl and expiration 2018-08-30 18:30:33 +08:00
Gilbert Wong b0ed953708 fix emqx_session:unsubscribe bug 2018-08-30 13:56:55 +08:00
Feng Lee 2342a7db6d Rename 'Pid' to 'ConnPid' 2018-08-30 11:48:49 +08:00
Feng Lee 53a2f93b7e Add emqx_connection:attrs/1, emqx_protocol:attrs/1, emqx_session:attrs/1 APIs 2018-08-30 03:03:19 +08:00
Feng Lee 8492513094
Merge branch 'emqx30' into emqx30-feng 2018-08-29 23:11:24 +08:00
Feng Lee 567aeb274f Define types in emqx_types, emqx_mqtt_types modules 2018-08-29 23:08:55 +08:00
turtled 1629215b18 Fix hook args bug 2018-08-29 20:29:03 +08:00
Feng Lee 465963fec3
Merge branch 'emqx30' into emqx30-feng 2018-08-29 17:36:38 +08:00
Feng Lee 1a7d60a7e3 Improve the hooks design for emqx 3.0 2018-08-29 17:27:56 +08:00
Feng Lee 594819b752 Upgrade the publish sequence of QoS1/2 messages 2018-08-29 02:53:22 +08:00
Feng Lee 8e11845f87 Remove ignore_loop_deliver option 2018-08-28 07:36:22 +08:00
Gilbert Wong 015901050f change return tuple of close_session 2018-08-27 18:19:28 +08:00
Gilbert Wong c5da439313 wrong unsubscribe call 2018-08-27 16:41:58 +08:00
Feng Lee 1aee05ce16 Fix unsubscribe bug 2018-08-25 16:03:28 +08:00
Feng Lee 68cfcf6e0e Pass paho mqtt interoperability tests 2018-08-24 23:19:11 +08:00
Feng Lee 0f052ce352 Upgrade connection, protocol and session modules for MQTT 5.0 2018-08-24 18:39:59 +08:00
Feng Lee f80cd2d986 Improve the MQTT over Websocket connection 2018-08-11 17:57:19 +08:00
Feng Lee 645c971a07 Fix QoS tuning 2018-08-06 17:09:14 +08:00
Feng Lee 7d0cba9427 Add MQTT 5.0 supports for connection, protocol and session modules 2018-08-06 16:33:10 +08:00
Feng Lee eeeed35e2a Remove the alarm_fun arg from emqx_mqueue:new/3 2018-07-19 10:46:05 +08:00
Feng Lee 7ee54aac28 Add 'qos' field to message record 2018-07-18 23:41:00 +08:00
Feng Lee bffdd2ba74 Upgrade esockd and add more test cases 2018-05-22 13:01:19 +08:00
Feng Lee 31bc091873 Implement MQTT Version 5.0 client 2018-05-06 17:45:18 +08:00
Feng Lee 16426346bb Fix whitespace 2018-04-24 17:31:31 +08:00
Feng Lee 2a4ffc6645 Add more service modules for MQTT Version 5.0 2018-04-18 16:34:23 +08:00
Feng Lee a902f508b5 Use emqx_config:get_env/1 to read env 2018-04-09 14:32:49 +08:00
Feng Lee 71acf91ace Replace lager with emqx_log 2018-04-09 12:34:53 +08:00
Feng Lee 5f32f3c560 Pass the paho interoperability tests 2018-04-08 16:37:30 +08:00
Feng Lee bfb23ff0b2 Improve the design of MQTT session management 2018-04-08 15:16:05 +08:00
Feng Lee 39548cc399 Improve the session management 2018-04-04 15:28:01 +08:00
Feng Lee 2eed46310c Misc fix for the MQTT Version 5.0 2018-03-30 17:18:08 +08:00
Feng Lee 9976327c8d Add emqx_mqtt module 2018-03-23 18:13:09 +08:00
Feng Lee 56b88dd7f7 Improve the design of session management 2018-03-23 16:39:23 +08:00
Feng Lee 282e341433 EMQ X R3.0 - Improve the design of pubsub and router 2018-03-21 16:48:52 +08:00
Feng Lee 6a957e1b33 Support MQTT Version 5.0 2018-03-02 20:18:27 +08:00
Feng Lee d7eae533ac Merge the emqx-mqtt5 library 2018-02-28 21:22:39 +08:00
Feng Lee d5893ba2be Replace gen_server2 with gen_server for we cannot trace the size of drain queue 2018-02-26 13:24:29 +08:00
Feng Lee fcb2ec8427 Merge the latest enterprise branch 2018-02-24 15:56:32 +08:00
Feng Lee b63c34ab14 Merge the latest master branch 2018-02-24 11:27:09 +08:00
Feng Lee 2cec86eba7 Merge with version 2.3.0 2017-11-21 14:14:12 +08:00
Feng Lee 49d91cf694 Rename 'message.offline' hook to 'message.dropped' 2017-10-31 15:19:53 +08:00
Feng Lee 4b8cd18f5d Merge with EMQ X project 2017-10-09 19:43:06 +08:00