emqx_message.hrl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2022-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -ifndef(EMQX_MESSAGE_HRL).
  17. -define(EMQX_MESSAGE_HRL, true).
  18. %% See 'Application Message' in MQTT Version 5.0
  19. -record(message, {
  20. %% Global unique message ID
  21. id :: binary(),
  22. %% Message QoS
  23. qos = 0,
  24. %% Message from
  25. from :: atom() | binary(),
  26. %% Message flags
  27. flags = #{} :: emqx_types:flags(),
  28. %% Message headers. May contain any metadata. e.g. the
  29. %% protocol version number, username, peerhost or
  30. %% the PUBLISH properties (MQTT 5.0).
  31. headers = #{} :: emqx_types:headers(),
  32. %% Topic that the message is published to
  33. topic :: emqx_types:topic(),
  34. %% Message Payload
  35. payload :: emqx_types:payload(),
  36. %% Timestamp (Unit: millisecond)
  37. timestamp :: integer(),
  38. %% Miscellaneous extensions, currently used for OpenTelemetry context propagation
  39. %% and storing mqueue/inflight insertion timestamps.
  40. %% It was not used prior to 5.4.0 and defaulted to an empty list.
  41. %% Must be a map now.
  42. extra = #{} :: term()
  43. }).
  44. -endif.