Skip to content

Commit

Permalink
fix: read topic from message receipt
Browse files Browse the repository at this point in the history
  • Loading branch information
rhblind committed Sep 27, 2024
1 parent 1e9e663 commit ebce1f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog

## 0.1.0 - Initial release
## v0.1.1 - Patch

_Released unreleased_

- Emitting `off_broadway_emqtt.receive_message.ack` reads message topic from message receipt instead of from the message body.
This ensures that topic is included in telemetry events even if the message has been altered during dispatch.

## v0.1.0 - Initial release

_Released 2024-09-24_

Expand Down
4 changes: 3 additions & 1 deletion lib/off_broadway/emqqt/message_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ defmodule OffBroadway.EMQTT.MessageHandler do
end

def ack_message(message, _ack_options) do
receipt = extract_message_receipt(message)

:telemetry.execute(
[:off_broadway_emqtt, :receive_message, :ack],
%{time: System.system_time(), count: 1},
%{topic: message.data.topic, receipt: extract_message_receipt(message)}
%{topic: receipt.topic, receipt: receipt}
)
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule OffBroadway.EMQTT.MixProject do
use Mix.Project

@version "0.1.0"
@version "0.1.1"
@description "An MQTT connector based on emqtt for Broadway."
@source_url "https://github.com/Intility/off_broadway_emqtt"

Expand Down

0 comments on commit ebce1f0

Please sign in to comment.