Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0B5D4C83-181F-44AD-8F24-95599BFD66B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{73CF9B6D-0B40-422E-8F55-9D0C134E9E37}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DAAE6286-93E2-4F2B-81D2-A32A9F024595}"
ProjectSection(SolutionItems) = preProject
..\azure-pipelines-ci.yml = ..\azure-pipelines-ci.yml
..\azure-pipelines.yml = ..\azure-pipelines.yml
..\Directory.Build.props = ..\Directory.Build.props
..\Directory.Build.targets = ..\Directory.Build.targets
..\GitVersion.yml = ..\GitVersion.yml
..\nuspec.props = ..\nuspec.props
..\resources.props = ..\resources.props
..\resources.targets = ..\resources.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{1026C1CC-83E8-444C-9B16-28E68C50A727}"
ProjectSection(SolutionItems) = preProject
..\templates\BuildStage.yml = ..\templates\BuildStage.yml
..\templates\CodeSignStage.yml = ..\templates\CodeSignStage.yml
..\templates\PackStage.yml = ..\templates\PackStage.yml
..\templates\PublishStage.yml = ..\templates\PublishStage.yml
..\templates\TestStage.yml = ..\templates\TestStage.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.CoreWCF.AzureQueueStorage", "src\Azure.CoreWCF.AzureQueueStorage.csproj", "{7335E4E7-CC37-4EDC-9570-3638B4C28461}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.CoreWCF.AzureQueueStorage.Tests", "tests\Azure.CoreWCF.AzureQueueStorage.Tests.csproj", "{9682A2EB-E4CD-4AF3-8F28-763F5D107969}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Debug|x64.ActiveCfg = Debug|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Debug|x64.Build.0 = Debug|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Debug|x86.ActiveCfg = Debug|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Debug|x86.Build.0 = Debug|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Release|Any CPU.Build.0 = Release|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Release|x64.ActiveCfg = Release|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Release|x64.Build.0 = Release|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Release|x86.ActiveCfg = Release|Any CPU
{7335E4E7-CC37-4EDC-9570-3638B4C28461}.Release|x86.Build.0 = Release|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Debug|x64.ActiveCfg = Debug|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Debug|x64.Build.0 = Debug|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Debug|x86.ActiveCfg = Debug|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Debug|x86.Build.0 = Debug|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Release|Any CPU.Build.0 = Release|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Release|x64.ActiveCfg = Release|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Release|x64.Build.0 = Release|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Release|x86.ActiveCfg = Release|Any CPU
{9682A2EB-E4CD-4AF3-8F28-763F5D107969}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1026C1CC-83E8-444C-9B16-28E68C50A727} = {DAAE6286-93E2-4F2B-81D2-A32A9F024595}
{7335E4E7-CC37-4EDC-9570-3638B4C28461} = {0B5D4C83-181F-44AD-8F24-95599BFD66B8}
{9682A2EB-E4CD-4AF3-8F28-763F5D107969} = {73CF9B6D-0B40-422E-8F55-9D0C134E9E37}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2C86AC5B-B946-48AD-A3A5-0E1A29EDA4CF}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32328.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreWCF.Templates", "CoreWCF.Templates\src\CoreWCF.Templates.csproj", "{B649E67D-97D2-42D9-BEC2-40FC180E7E16}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreWCF.Templates.Tests", "CoreWCF.Templates\tests\CoreWCF.Templates.Tests.csproj", "{5F96545E-720F-42C1-9B0F-ED73FBE13A86}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{4A29535E-AE2F-4927-ADB6-4063A0F001D0}"
ProjectSection(SolutionItems) = preProject
CoreWCF.Templates\Clean-Run.ps1 = CoreWCF.Templates\Clean-Run.ps1
CoreWCF.Templates\Prepare-Run.ps1 = CoreWCF.Templates\Prepare-Run.ps1
CoreWCF.Templates\Run-Templates-UnitTests.ps1 = CoreWCF.Templates\Run-Templates-UnitTests.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C305A45D-9B9A-482A-9951-EA788C0169F3}"
ProjectSection(SolutionItems) = preProject
CoreWCF.Templates\README.md = CoreWCF.Templates\README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B649E67D-97D2-42D9-BEC2-40FC180E7E16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B649E67D-97D2-42D9-BEC2-40FC180E7E16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B649E67D-97D2-42D9-BEC2-40FC180E7E16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B649E67D-97D2-42D9-BEC2-40FC180E7E16}.Release|Any CPU.Build.0 = Release|Any CPU
{5F96545E-720F-42C1-9B0F-ED73FBE13A86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F96545E-720F-42C1-9B0F-ED73FBE13A86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F96545E-720F-42C1-9B0F-ED73FBE13A86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F96545E-720F-42C1-9B0F-ED73FBE13A86}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {36E194F1-322D-410F-8C9F-9DF7DDE2E097}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions sdk/wcf/Microsoft.Azure.CoreWCF.Storage.Queues/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Using the CoreWCF Postman Samples Collection.json within Postman

- Run the DesktopServer or NetCoreServer example applications
- Start Postman
- Go to 'File' and then select 'Import..' on the dropdown menu
- Click on 'Choose Files'
- Browse to thse location of, and select, the JSON file
- Expand the collection in the left-hand pane and select the 'CoreWCF NetCoreServer Sample Request'
- Click on 'Send'
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Azure.CoreWCF.AzureQueueStorage</AssemblyName>
<PackageId>Azure.CoreWCF.AzureQueueStorage</PackageId>
<RootNamespace />
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Queues" />
<PackageReference Include="System.IO.Pipelines" VersionOverride="6.0.3" />
<PackageReference Include="CoreWCF.Queue" VersionOverride="1.4.0-preview1" />
</ItemGroup>

<ItemGroup>
<Folder Include="CoreWCF\Configuration\" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.5-beta1.23165.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview1.23165.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="SauceControl.InheritDoc" Version="1.3.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Storage.CoreWCF.Channels;
using System;
using System.Threading.Tasks;
using System.Threading;
using Azure.Storage.Queues.Models;

namespace CoreWCF.Channels
{
internal class AzureQueueReceiveContext : ReceiveContext
{
private readonly DeadLetterQueue _deadLetterQueueSender;
private readonly QueueMessage _queueMessage;

public AzureQueueReceiveContext(QueueMessage queueMessage, DeadLetterQueue deadLetterQueueSender)
{
_deadLetterQueueSender = deadLetterQueueSender;
_queueMessage = queueMessage;
}

protected override async Task OnAbandonAsync(CancellationToken token)
{
await _deadLetterQueueSender.SendMessageAsync(_queueMessage.Body, default).ConfigureAwait(false);
}

protected override Task OnCompleteAsync(CancellationToken token)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Net;
using Azure.Storage.Queues;
using CoreWCF.Channels;

namespace Azure.Storage.CoreWCF.Channels
{
/// <summary>
/// The class storing binding information
/// </summary>
public class AzureQueueStorageBinding : Binding
{
private TextMessageEncodingBindingElement _textMessageEncodingBindingElement;
private AzureQueueStorageTransportBindingElement _transport;
private BinaryMessageEncodingBindingElement _binaryMessageEncodingBindingElement;
private bool _isInitialized;

/// <summary>
/// Constructor to initialize member variables.
/// </summary>
public AzureQueueStorageBinding()
{
Initialize();
}

/// <summary>
/// Method to create Binding elements
/// </summary>
public override BindingElementCollection CreateBindingElements()
{
//_transport.BrokerProtocol = BrokerProtocol;
_transport.MaxReceivedMessageSize = TransportDefaults.DefaultMaxMessageSize;
BindingElementCollection elements = new BindingElementCollection();

switch (MessageEncoding)
{
case AzureQueueStorageMessageEncoding.Binary:
elements.Add(_binaryMessageEncodingBindingElement);
break;
case AzureQueueStorageMessageEncoding.Text:
elements.Add(_textMessageEncodingBindingElement);
break;
default:
elements.Add(_textMessageEncodingBindingElement);
break;
}

elements.Add(_transport);

return elements;
}

private void Initialize()
{
if (!_isInitialized)
{
_transport = new AzureQueueStorageTransportBindingElement();
_textMessageEncodingBindingElement = new TextMessageEncodingBindingElement();
_binaryMessageEncodingBindingElement = new BinaryMessageEncodingBindingElement();
MaxMessageSize = TransportDefaults.DefaultMaxMessageSize;
_isInitialized = true;
}
}

/// <summary>
/// Gets the scheme used by the binding, soap.amqp
/// </summary>
public override string Scheme
{
get { return _transport.Scheme; }
}

/// <summary>
/// Specifies the maximum encoded message size
/// </summary>
public long MaxMessageSize
{
get => _transport.MaxReceivedMessageSize;
set => _transport.MaxReceivedMessageSize = value;
}

/// <summary>
/// Sets the message encoding.
/// </summary>
public AzureQueueStorageMessageEncoding MessageEncoding { get; set; } = AzureQueueStorageMessageEncoding.Text;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Globalization;
using CoreWCF;

namespace Azure.Storage.CoreWCF.Channels
{
internal static class AzureQueueStorageChannelHelpers
{
/// <summary>
/// The Channel layer normalizes exceptions thrown by the underlying networking implementations
/// into subclasses of CommunicationException, so that Channels can be used polymorphically from
/// an exception handling perspective.
/// </summary>
internal static CommunicationException ConvertTransferException(Exception e)
{
return new CommunicationException(
string.Format(CultureInfo.CurrentCulture,
"An error ({0}) occurred while transmitting message.", e.Message),
e);
}

internal static void ThrowIfDisposedOrNotOpen(object state)
{
switch (state)
{
case CommunicationState.Created:
case CommunicationState.Opening:
case CommunicationState.Closing:
case CommunicationState.Closed:
case CommunicationState.Faulted:
throw new CommunicationException("ThrowIfDisposedOrNotOpen: Communicate object not in open state. Current state: " + state.ToString());
default:
throw new CommunicationException("ThrowIfDisposedOrNotOpen: Unknown CommunicationObject.state");
case CommunicationState.Opened:
break;
}
}

internal static void ValidateTimeout(TimeSpan timeout)
{
if (timeout < TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException(nameof(timeout), timeout, "Timeout must be greater than or equal to TimeSpan.Zero. To disable timeout, specify TimeSpan.MaxValue.");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using CoreWCF.Queue.Common;

namespace Azure.Storage.CoreWCF.Channels
{
internal class AzureQueueStorageMessageContext : QueueMessageContext
{
private IDictionary<string, object> _properties = new Dictionary<string, object>();

public override IDictionary<string, object> Properties
{
get { return _properties; }
}

public void SetProperties(IDictionary<string, object> properties)
{
_properties = properties;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Storage.CoreWCF.Channels
{
/// <summary>
/// The enum which will be used by message encoder.
/// </summary>
public enum AzureQueueStorageMessageEncoding
{
/// <summary>
/// Indicates using Binary message encoder.
/// </summary>
Binary,

/// <summary>
/// Indicates using Text message encoder.
/// </summary>
Text,
}
}
Loading