Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed exception type in BrokerConnection::SendAsync, #5091

Merged
merged 3 commits into from
Jun 15, 2021

Conversation

vipeller
Copy link
Contributor

@vipeller vipeller commented Jun 8, 2021

so operation will be retried if no mqttclient exists.

The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.

@vipeller vipeller requested a review from ancaantochi June 8, 2021 21:36
@@ -166,7 +168,7 @@ public async Task DisconnectAsync()

public async Task<bool> SendAsync(string topic, byte[] payload, bool retain = false)
{
var client = this.mqttClient.Expect(() => new Exception("No mqtt-bridge connector instance found to send messages."));
var client = this.mqttClient.Expect(() => new IOException("No mqtt-bridge connector instance found to send messages."));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOException is typically used for file I/O.. so it seems a little odd here. Can we use a custom exception here?

Copy link
Contributor

@varunpuranik varunpuranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch..
Suggest changing the exception thrown to some custom exception..

@kodiakhq kodiakhq bot merged commit bbe3525 into Azure:master Jun 15, 2021
huguesBouvier pushed a commit to huguesBouvier/iotedge that referenced this pull request Jun 28, 2021
so operation will be retried if no mqttclient exists.

The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.
ggjjj pushed a commit to ggjjj/iotedge that referenced this pull request Jul 22, 2021
so operation will be retried if no mqttclient exists.

The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.
damonbarry pushed a commit to damonbarry/iotedge that referenced this pull request Apr 15, 2022
so operation will be retried if no mqttclient exists.

The problem occurred when EdgeHub was shutting down but a message was being sent upstream. As the protocol head was stopped, that cleared the mqttclient client, so the send operation in SendAsync() threw an 'Exception' instance, which was not retriable by CloudEndpoint, so it just skipped the message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants