Commit Graph

57 Commits

Author SHA1 Message Date
Zaiming (Stone) Shi 14ba75502f chore: update copyright year 2023-01-02 14:54:38 +01:00
Thales Macedo Garitezi 977ac04d24 chore: fix dialyzer errors 2022-08-26 16:09:39 -03:00
JimMoen 6168745f90 chore: update copyright 2022-04-14 11:23:25 +08:00
Ilya Averyanov 557c52dd8a chore(codestyle): remove Elvis 2022-02-18 20:35:19 +03:00
Shawn 8cf268dffb fix: emqx_message:format/1 failed on undefined message id 2022-02-10 12:43:39 +08:00
Shawn 3b5b4b99ed fix(log): format the message id to hexstring before printing 2022-02-10 09:47:33 +08:00
Zaiming Shi 6354e75626 chore: update copyrights 2021-04-23 20:43:00 +02:00
z8674558 e9180b9ce8 chore(emqx_messages): fix elvis 2021-03-11 16:01:35 +09:00
z8674558 9087f0c138 feat(emqx_message): add from_map 2021-03-11 16:01:30 +09:00
terry-xiaoyu 211c800e24 fix(properties): downlink will msg contains non-publish properties
The paho test failed because the client received a will message
that has an `Will-Delay-Interval` property.

All the 7 allowed PUBLISH properties are listed as follows:

```
'Payload-Format-Indicator',
'Message-Expiry-Interval',
'Response-Topic',
'Correlation-Data',
'User-Property',
'Subscription-Identifier',
'Content-Type'
```
2020-06-21 11:27:22 +08:00
JianBo He e3489b9d46 refactor(style): improve all types declaration
- Add dialyzer for code analysis
- Correct all the module type declarations
- Use `-type()` to declaration a type instead of `-opaque`
  (It is advantageous to the code dialyzer)

BROKEN CHANGES:
- Add a ?DEFAULT_SUBOPTS for emqx_broker:subscribe/1,2,3
- Remove the needless internal function `emqx_vm:port_info(PortTerm, Keys)`
2020-06-18 17:38:34 +08:00
terry-xiaoyu 6ad65d587e feature(properties): add properties in message header
1. Add MQTT5.0 properties when invoking the hooks.

- Add a new key `properties` into the message header:

  We used to put all of the properties into the `#message.headers`:

  ```erlang
  #message{headers = #{'User-Property' => {<<"reason">>,<<"normal">>},
                       'Message-Expiry-Interval' => 60,
                       allow_publish => true}
  ```

  I put them instead under a single key:

  ```erlang
  #message{headers = #{properties =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>},
                          'Message-Expiry-Interval' => 60},
                       allow_publish => true}
  ```

  Note that the column `properties` may contain all the properties for
  Publish and Will messages.

- Add `disconn_props` into the `Channel.conninfo`

- Add `puback_props` also into the message header:

  ```erlang
  #message{headers = #{puback_props =>
                        #{'User-Property' => {<<"reason">>,<<"normal">>}},
                       allow_publish => true}
  ```

2. Change the data type of `#message.headers` and `#message.flags` to map.

   It used to support `undefined`.
2020-06-17 18:46:26 +08:00
zhouzb 7ea75f4289 Update copyright 2020-01-03 18:31:08 +08:00
Feng Lee 578355442b Add more metrics and improve the 'channel', 'session' modules (#3128) 2019-12-20 21:47:32 +08:00
Feng Lee 0f9f1258b6 Improve the emqx_message module and add more test cases
- Add 'emqx_message:clean_dup/1' function
- Clean dup flag before publishing a message
- Add more test cases for emqx_message module
2019-12-10 09:22:38 +08:00
Feng Lee 0c377c67cd Use 'erlang:system_time' to replace 'os:timestamp' (#3088)
Use 'erlang:system_time/1' to replace 'os:timestamp/0'
2019-12-09 16:27:25 +08:00
Feng Lee 20ddd498fc Rename the 'client_id' field to 'clientid' 2019-09-24 17:06:25 +08:00
Feng Lee 3d6b96d321 Add function 'get_flags/1' for test 2019-09-19 11:19:10 +08:00
Feng Lee 4764a7707c Rewrite the emqx_packet module and improve channel pipeline (#2903)
Add use_username_as_clientid/1 function and Improve function 'pipeline/3'
2019-09-16 14:17:36 +08:00
Feng Lee c95a89ed1e Merge branch 'nchannel' into develop 2019-07-31 14:03:48 +08:00
Feng Lee 6b84eb0595 Rewrite the channel, protocol and session modules. 2019-07-22 17:08:53 +08:00
terry-xiaoyu 6ab9527603 Optimize to_map for performance 2019-07-05 23:14:27 +08:00
Feng Lee 21162f88b8 Update copyright 2019-06-18 14:27:06 +08:00
Shawn 2306789755 Remove bin_key_map/1 (#2393)
* Remove bin_key_map/1

* Fix Travis-CI failure
2019-04-03 19:41:21 +08:00
Feng Lee 60c2b8bc08 Add more functions to read fields of 'message' record
- Add id/1, topic/1, from/1, payload/1 and timestamp/1 functions
- Improve the test cases
2019-04-02 15:15:13 +08:00
Shawn a3fd8846a5
Bin key map (#2362)
Suppport nested bin-key map
2019-03-27 11:12:28 +08:00
Shawn f0fa9a9252 Add a function converting message to binary-key map (#2360) 2019-03-26 10:35:10 +08:00
HeeeJianBo fc2df9aff5 Adapt to new export style 2019-03-22 14:58:24 +08:00
Gilbert e386778aca Fix typo 2019-03-22 11:31:26 +08:00
Feng Lee dba16aeea5 Add 'remove_header/2', 'get_headers/1' functions
- Adopt new 'export' style
- Add 'remove_header/2', 'get_headers/1' functions
- Remove 'remove_topic_alias/1' function
2019-03-22 11:31:26 +08:00
spring2maz a72a914fb8 Fix issue #2312 (#2313)
* Fix SSL option parser

* Fix bridge disconnect log formatting

* Set no headers if new headers is undefined
2019-03-16 19:28:57 +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
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
turtleDeng a5f9466040 QoS0 msg support msgid (#2145)
* QoS0 msg support msgid

* Fix testcase
2019-01-11 11:47:10 +08:00
tigercl edf0ded9f3 Fix bug that no update message expiry interval (#2101) 2018-12-22 11:32:22 +08:00
周子博 c76e2d1413 Fix 'badarg' in io_lib:format/2 when 'from' field is tuple 2018-11-09 18:32:26 +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
Gilbert Wong 45b2686e1c Delete unnecessary code
Prior to this change, there are multiple deprecated functions.
2018-09-14 09:45:34 +08:00
Feng Lee cae673cf5e Fix update_expiry/1 function_clause 2018-08-30 18:59:47 +08:00
Feng Lee 021d43755f Add update_expiry/1 function 2018-08-30 18:28:02 +08:00
Feng Lee 2351b41f11 Add is_expired/1, check_expiry/1, check_expiry/2 2018-08-30 11:40:53 +08:00
Feng Lee 567aeb274f Define types in emqx_types, emqx_mqtt_types modules 2018-08-29 23:08:55 +08:00
Feng Lee 1a7d60a7e3 Improve the hooks design for emqx 3.0 2018-08-29 17:27:56 +08:00
turtled 22e8b07a3d Receive/send messages by bridge 2018-08-19 20:31:44 +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 7ee54aac28 Add 'qos' field to message record 2018-07-18 23:41:00 +08:00
Feng Lee 62aa072f2f Upgrade for MQTT Version 5.0 and Erlang/OTP R21 2018-07-18 13:43:17 +08:00
Feng Lee 1de94b6858 Register the default ACL module in emqx_access_control 2018-06-21 22:40:30 +08:00
Feng Lee 055de617fc Add emqx_message:make/4 and fix whitespace 2018-05-31 21:57:17 +08:00
Feng Lee 2a4ffc6645 Add more service modules for MQTT Version 5.0 2018-04-18 16:34:23 +08:00