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`.
* Wrapper proper test cases into common test cases
* Improve test cases for reason code module (#2789)
* Split 3 proper tests into 3 ct cases
* Improve test cases for client, rpc and request-response
* Add psk suites to increase coverage
* Add sys test cases
* 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.
* 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
Before this change, eqmx_mock_client uses a shared ets table
to store last received message, this causes troulbe when we
want to start / stop two or more clients in one test case
the ets table gets owned by the first spanwed client and
gets closed when the owner client dies.
Now it keeps the last received message in process state
and a gen_server call is added to retrieve it for verification
Along with this change in emqx_mock_client, it made possible
to write test case to verify the actual subscriber pid
used in shared subscription strategy, so test cases were
added (and modified) to verify different strategies