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

Service client samples, bug fix #3261

Merged
merged 7 commits into from
Apr 10, 2023
Merged

Conversation

timtay-microsoft
Copy link
Member

  • Add messaging client sample
  • Add retry logic to file upload notification sample
  • Fix bug where error processor would execute 3 times on a connection loss event
    • The same event handler was hooked up to the connection drop, session drop, and link drop event. Now the link drop event just triggers the session to close and the session drop event just triggers the connection to close. Only the connection layer can trigger the "Connection lost" event

@@ -69,41 +72,8 @@ private async Task ReceiveFileUploadNotificationsAsync(string targetDeviceId, Ca

_logger.LogInformation($"Listening for file upload notifications from the service.");

Task<AcknowledgementType> FileUploadNotificationCallback(FileUploadNotification fileUploadNotification)
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving this to a private function outside of this function so this sample is more readable

@@ -20,7 +20,6 @@ internal class AmqpCbsSessionHandler : IDisposable
private readonly IotHubConnectionProperties _credential;

private AmqpCbsLink _cbsLink;
private readonly EventHandler _connectionLossHandler;
Copy link
Member Author

Choose a reason for hiding this comment

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

Unused. CBS links don't allow for subscribing to link drop events for some reason.

<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

<!--<ItemGroup Condition="'$(Configuration)' == 'Release'">
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to keep this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see this same block in all the other samples, so I believe David has something in mind with this commented out code.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can put it in after we GA, so customers will get the shipped nuget tested if they run Release.

We can choose to only use project reference tho. If we add new functionality to an SDK and use it in a sample, it'd otherwise be broken in Release until after we release, so this may not have been my brightest idea.

@timtay-microsoft
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@timtay-microsoft
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@timtay-microsoft timtay-microsoft merged commit 50880e1 into previews/v2 Apr 10, 2023
@timtay-microsoft timtay-microsoft deleted the timtay/samples2 branch April 10, 2023 22:44
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>9.0</LangVersion>
Copy link
Contributor

Choose a reason for hiding this comment

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

Make not packable

@@ -35,25 +36,25 @@ protected internal AmqpSessionHandler()
/// upload notifications or receiving feedback messages.
/// </summary>
/// <param name="linkAddress">The link address to receive from/send to.</param>
/// <param name="connectionLossHandler">The handler to invoke if this session or its links are dropped.</param>
/// <param name="sessionLossHandler">The handler to invoke if this session or its links are dropped.</param>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the comment still mention dropped links?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes because this handler is still eventually invoked if its links are dropped. A link drop triggers the session to close.

timtay-microsoft added a commit that referenced this pull request Apr 17, 2023
timtay-microsoft added a commit that referenced this pull request Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants