Skip to content
Browse files

warnings cleanup and documentation improvements + tests passing

  • Loading branch information...
1 parent 53677ef commit e7f2947a806a81c43325d747f34b845bb2d5f86b @haf haf committed
Showing with 422 additions and 163 deletions.
  1. +5 −1 README.md
  2. +30 −13 rakefile.rb
  3. +0 −3 src/MassTransit-AzureServiceBus.sln
  4. +6 −1 src/MassTransit.Async/Receiver.fs
  5. +6 −0 src/MassTransit.AzureServiceBus/MassTransit.AzureServiceBus.csproj
  6. +3 −0 src/MassTransit.AzureServiceBus/MessageReceiver.cs
  7. +7 −0 src/MassTransit.AzureServiceBus/MessageSender.cs
  8. +7 −0 src/MassTransit.AzureServiceBus/NameHelper.cs
  9. +29 −1 src/MassTransit.AzureServiceBus/QueueDescription.cs
  10. +4 −4 src/MassTransit.AzureServiceBus/ReceiverSettings.cs
  11. +0 −24 src/MassTransit.AzureServiceBus/TopicDescription.cs
  12. +2 −0 src/MassTransit.AzureServiceBus/Util/JetbrainsCodeAnnotations.cs
  13. +1 −1 src/MassTransit.Transports.AzureServiceBus.Tests/Azure_management_impl_spec.cs
  14. +2 −0 src/MassTransit.Transports.AzureServiceBus.Tests/MassTransit.Transports.AzureServiceBus.Tests.csproj
  15. +1 −1 src/MassTransit.Transports.AzureServiceBus.Tests/Publish_roundtrip_spec.cs
  16. +4 −4 src/MassTransit.Transports.AzureServiceBus.Tests/Publish_spec.cs
  17. +6 −0 src/MassTransit.Transports.AzureServiceBus/AzureMessageNameFormatter.cs
  18. +5 −0 src/MassTransit.Transports.AzureServiceBus/AzureServiceBusEndpointAddressImpl.cs
  19. +2 −0 src/MassTransit.Transports.AzureServiceBus/Configuration/AzureManagementEndpointManagement.cs
  20. +71 −40 src/MassTransit.Transports.AzureServiceBus/Configuration/AzureServiceBusFactoryConfiguratorImpl.cs
  21. +18 −7 src/MassTransit.Transports.AzureServiceBus/Configuration/AzureServiceBusServiceBusExtensions.cs
  22. +2 −0 src/MassTransit.Transports.AzureServiceBus/Configuration/Credentials.cs
  23. +3 −1 src/MassTransit.Transports.AzureServiceBus/Configuration/EndpointFactoryConfiguratorExtensions.cs
  24. +15 −0 src/MassTransit.Transports.AzureServiceBus/Configuration/PreSharedKeyCredentials.cs
  25. +8 −0 src/MassTransit.Transports.AzureServiceBus/Configuration/PublishEndpointInterceptor.cs
  26. +7 −1 src/MassTransit.Transports.AzureServiceBus/Configuration/PublishEndpointSinkLocator.cs
  27. +2 −1 src/MassTransit.Transports.AzureServiceBus/ConnectionImpl.cs
  28. +3 −0 src/MassTransit.Transports.AzureServiceBus/Constants.cs
  29. +2 −0 src/MassTransit.Transports.AzureServiceBus/InboundTransportImpl.cs
  30. +1 −1 src/MassTransit.Transports.AzureServiceBus/Internal/TaskExtensions.cs
  31. +3 −0 src/MassTransit.Transports.AzureServiceBus/Management/AzureManagement.cs
  32. +6 −0 src/MassTransit.Transports.AzureServiceBus/Management/NamespaceManagerExtensions.cs
  33. +8 −3 src/MassTransit.Transports.AzureServiceBus/Management/{AzureManagementImpl.cs → PurgeImpl.cs}
  34. +3 −1 src/MassTransit.Transports.AzureServiceBus/MassTransit.Transports.AzureServiceBus.csproj
  35. +6 −0 src/MassTransit.Transports.AzureServiceBus/MessageEnvelope.cs
  36. +33 −11 src/MassTransit.Transports.AzureServiceBus/OutboundTransportImpl.cs
  37. +10 −14 src/MassTransit.Transports.AzureServiceBus/PerConnectionReceiver.cs
  38. +5 −0 src/MassTransit.Transports.AzureServiceBus/QueueDescriptionImpl.cs
  39. +4 −9 src/MassTransit.Transports.AzureServiceBus/Testing/AzureServiceBusScenarioBuilder.cs
  40. +9 −1 src/MassTransit.Transports.AzureServiceBus/Testing/BusTestScenarioExtensions.cs
  41. +5 −0 src/MassTransit.Transports.AzureServiceBus/TopicDescriptionImpl.cs
  42. +2 −0 src/MassTransit.Transports.AzureServiceBus/TopicSubscriptionObserver.cs
  43. +68 −17 src/MassTransit.Transports.AzureServiceBus/TransportFactoryImpl.cs
  44. +2 −0 ...ormanceTesting/MassTransit.AzurePerformance.Messages/MassTransit.AzurePerformance.Messages.csproj
  45. +2 −0 ...ormanceTesting/MassTransit.AzurePerformance.Receiver/MassTransit.AzurePerformance.Receiver.csproj
  46. +2 −0 ...PerformanceTesting/MassTransit.AzurePerformance.Sender/MassTransit.AzurePerformance.Sender.csproj
  47. +2 −3 src/PerformanceTesting/Utils/Utils.fsproj
View
6 README.md
@@ -125,4 +125,8 @@ namespace MassTransit.Transports.AzureServiceBus.Tests.Framework
}
```
-Place this file in `src\MassTransit.Transports.AzureServiceBus.Tests\Framework\AccountDetails.cs`.
+Place this file in `src\MassTransit.Transports.AzureServiceBus.Tests\Framework\AccountDetails.cs`.
+
+## Contributing
+
+Download the code. Hack on it in a feature branch like described with [this flow](https://github.com/haf/Documently/wiki/Git-Workflow). Send a pull request to /develop from your feature branch.
View
43 rakefile.rb
@@ -17,6 +17,20 @@ def conf_assert
unless File.exists? targ then ; FileUtils.cp 'build_support/ServiceConfiguration.Cloud.cscfg', targ ; end
end
+desc "Update the common version information for the build. You can call this task without building."
+assemblyinfo :global_version => [:versioning] do |asm|
+ # Assembly file config
+ asm.product_name = 'MassTransit.Transports.AzureServiceBus'
+ asm.version = FORMAL_VERSION
+ asm.file_version = FORMAL_VERSION
+ asm.custom_attributes :AssemblyInformationalVersion => "#{BUILD_VERSION}",
+ :ComVisibleAttribute => false,
+ :CLSCompliantAttribute => false
+ asm.copyright = 'Henrik Feldt 2012'
+ asm.output_file = 'src/SolutionVersion.cs'
+ asm.namespaces "System", "System.Reflection", "System.Runtime.InteropServices", "System.Security"
+end
+
desc "Ensure that all NuGet packages are here"
task :ensure_packages do
Dir.glob("./src/**/packages.config") do |cfg|
@@ -27,7 +41,7 @@ def conf_assert
end
desc "Compile Solution"
-msbuild :compile => [:ensure_packages, :ensure_account_details] do |msb|
+msbuild :compile => [:ensure_packages, :ensure_account_details, :global_version] do |msb|
msb.solution = 'src/MassTransit-AzureServiceBus.sln'
msb.properties :Configuration => CONFIGURATION
msb.targets :Build
@@ -49,8 +63,11 @@ def conf_assert
task :nuspec_copy do
conf_assert
- FileList[File.join('src', "MassTransit.*/**/bin/#{CONFIGURATION}/MassTransit.Transports.AzureServiceBus.*")].collect{ |f|
- to = File.join( 'build/nuspec/MassTransit.AzureServiceBus', "lib", FRAMEWORK )
+ FileList[File.join('src', "*/bin", CONFIGURATION, "MassTransit.*.{dll,xml}")].keep_if{ |f|
+ ff = f.downcase
+ !(ff.include?("test") || ff.include?("msmq"))
+ }.each { |f|
+ to = File.join( 'build/nuspec', 'lib', FRAMEWORK )
FileUtils.mkdir_p to
cp f, to
File.join(FRAMEWORK, File.basename(f))
@@ -63,8 +80,9 @@ def conf_assert
nuspec :nuspec => ['build/nuspec', :nuspec_copy] do |nuspec|
conf_assert
nuspec.id = "MassTransit.AzureServiceBus"
- nuspec.version = BUILD_VERSION
+ nuspec.version = NUGET_VERSION
nuspec.authors = "Henrik Feldt, MPS Broadband"
+ nuspec.owners = "Henrik Feldt"
nuspec.description = "MassTransit transport library for Azure ServiceBus."
nuspec.title = "MassTransit Azure ServiceBus Transport"
nuspec.projectUrl = 'https://github.com/MassTransit/MassTransit-AzureServiceBus'
@@ -76,15 +94,14 @@ def conf_assert
nuspec.output_file = 'build/nuspec/MassTransit.AzureServiceBus.nuspec'
end
-task :nugets => [:release, :nuspec, :nuget]
-
directory 'build/nuget'
desc "nuget pack 'MassTransit.AzureServiceBus'"
-nugetpack :nuget => ['build/nuget'] do |nuget|
- nuget.command = 'src/.nuget/NuGet.exe'
- nuget.nuspec = 'build/nuspec/MassTransit.AzureServiceBus.nuspec'
- nuget.output = 'build/nuget'
+nugetpack :nuget => ['build/nuget', :nuspec] do |nuget|
+ conf_assert
+ nuget.command = 'src/.nuget/NuGet.exe'
+ nuget.nuspec = 'build/nuspec/MassTransit.AzureServiceBus.nuspec'
+ nuget.output = 'build/nuget'
end
desc "publishes (pushes) the nuget package 'MassTransit.AzureServiceBus'"
@@ -106,7 +123,7 @@ def conf_assert
end
end
-task :versioning do
+task :git do
v = SemVer.find
if `git tag`.split("\n").include?("#{v.to_s}")
raise "Version #{v.to_s} has already been released! You cannot release it twice."
@@ -120,7 +137,7 @@ def conf_assert
`git push --tags`
end
-desc "Perform a Release!"
-task :everything => [:verify, :default, :versioning, :publish] do
+desc "Perform a Full-on Release!"
+task :everything => [:verify, :default, :git, :publish] do
puts 'done'
end
View
3 src/MassTransit-AzureServiceBus.sln
@@ -2,9 +2,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B57B3247-3B1B-42F1-8C3B-203CA42BB110}"
- ProjectSection(SolutionItems) = preProject
- .nuget\NuGet.exe = .nuget\NuGet.exe
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{5E58A17C-99DE-46F2-A42D-353F97F5C277}"
ProjectSection(SolutionItems) = preProject
View
7 src/MassTransit.Async/Receiver.fs
@@ -369,7 +369,12 @@ type Receiver(desc : QueueDescription,
/// or otherwise returns null.
member x.Get(timeout : TimeSpan) =
let mutable item = null
- let _ = messages.TryTake(&item, timeout)
+ // concurrent queue doesn't like waiting TimeSpan.MaxValue
+ let t' = if timeout.TotalMilliseconds > float Int32.MaxValue
+ then Int32.MaxValue
+ else int <| timeout.TotalMilliseconds
+
+ let _ = messages.TryTake(&item, t')
item
member x.Consume() = asyncSeq { while true do yield messages.Take() }
View
6 src/MassTransit.AzureServiceBus/MassTransit.AzureServiceBus.csproj
@@ -22,6 +22,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Debug\MassTransit.AzureServiceBus.xml</DocumentationFile>
+ <NoWarn>1685</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,6 +32,8 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Release\MassTransit.AzureServiceBus.xml</DocumentationFile>
+ <NoWarn>1685</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Magnum, Version=2.0.0.4, Culture=neutral, processorArchitecture=MSIL">
@@ -56,9 +60,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AzureServiceBusEndpointAddress.cs" />
+ <Compile Include="EntityDescription.cs" />
<Compile Include="MessageReceiver.cs" />
<Compile Include="MessageSender.cs" />
<Compile Include="NameHelper.cs" />
+ <Compile Include="PathBasedEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QueueDescription.cs" />
<Compile Include="ReceiverSettings.cs" />
View
3 src/MassTransit.AzureServiceBus/MessageReceiver.cs
@@ -17,6 +17,9 @@
namespace MassTransit.AzureServiceBus
{
+ /// <summary>
+ /// Thing picking brokered messages from the network.
+ /// </summary>
[UsedImplicitly] // in F#
public interface MessageReceiver
{
View
7 src/MassTransit.AzureServiceBus/MessageSender.cs
@@ -21,7 +21,14 @@ namespace MassTransit.AzureServiceBus
/// </summary>
public interface MessageSender : IDisposable
{
+ /// <summary>
+ /// Begin the asynchronous send of a message
+ /// </summary>
IAsyncResult BeginSend(BrokeredMessage message, AsyncCallback callback, object state);
+
+ /// <summary>
+ /// End the asynchronous send of a message.
+ /// </summary>
void EndSend(IAsyncResult result);
}
}
View
7 src/MassTransit.AzureServiceBus/NameHelper.cs
@@ -4,11 +4,18 @@
namespace MassTransit.AzureServiceBus
{
+ /// <summary>
+ /// Name generator
+ /// </summary>
[UsedImplicitly] // from F#
public static class NameHelper
{
static readonly Random _r = new Random();
+ /// <summary>
+ /// Generate a new random name, 20 characters long, with characters a-z, lowercase.
+ /// </summary>
+ /// <returns></returns>
public static string GenerateRandomName()
{
var characters = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
View
30 src/MassTransit.AzureServiceBus/QueueDescription.cs
@@ -15,6 +15,11 @@
namespace MassTransit.AzureServiceBus
{
+ /// <summary>
+ /// DTO with properties relating to a queue. Equatable, comparable
+ /// and based on the Azure API's <see cref="PathBasedEntity"/> and <see cref="EntityDescription"/>
+ /// that are internal.
+ /// </summary>
public interface QueueDescription
: IEquatable<QueueDescription>,
IComparable<QueueDescription>,
@@ -22,16 +27,39 @@ public interface QueueDescription
PathBasedEntity,
EntityDescription
{
+ /// <summary>
+ /// How long before the consumed message is re-inserted into the queue?
+ /// </summary>
TimeSpan LockDuration { get; }
+ /// <summary>
+ /// Whether the queue is configured to be session-ful;
+ /// allowing a primitive key-value store as well as de-duplication
+ /// on a per-receiver basis.
+ /// </summary>
bool RequiresSession { get; }
+ /// <summary>
+ /// Property talks for itself.
+ /// </summary>
bool EnableDeadLetteringOnMessageExpiration { get; }
+ /// <summary>
+ /// The maximum times to try to redeliver a message before moving it
+ /// to a poision message queue. Note - this property would preferrably be int.MaxValue, since MassTransit
+ /// handles the poison message queues itself and there's no need to use the
+ /// AzureServiceBus API for this.
+ /// </summary>
int MaxDeliveryCount { get; }
-
+
+ /// <summary>
+ /// Gets the number of messages present in the queue
+ /// </summary>
long MessageCount { get; }
+ /// <summary>
+ /// Gets the inner <see cref="Microsoft.ServiceBus.Messaging.QueueDescription"/>.
+ /// </summary>
Microsoft.ServiceBus.Messaging.QueueDescription Inner { get; }
}
}
View
8 src/MassTransit.AzureServiceBus/ReceiverSettings.cs
@@ -43,9 +43,9 @@ public interface ReceiverSettings
/// </summary>
TimeSpan ReceiveTimeout { get; }
- /// <summary>
- /// Gets the receiver name.
- /// </summary>
- string ReceiverName { get; }
+ /// <summary>
+ /// Gets the receiver name.
+ /// </summary>
+ string ReceiverName { get; }
}
}
View
24 src/MassTransit.AzureServiceBus/TopicDescription.cs
@@ -1,31 +1,7 @@
using System;
-using System.Runtime.Serialization;
-using MassTransit.AzureServiceBus.Util;
namespace MassTransit.AzureServiceBus
{
- public interface PathBasedEntity
- {
- /// <summary>
- /// Gets the entity path
- /// </summary>
- [NotNull]
- string Path { get; }
- }
-
- public interface EntityDescription
- {
- bool IsReadOnly { get; }
- ExtensionDataObject ExtensionData { get; }
-
- TimeSpan DefaultMessageTimeToLive { get; }
- long MaxSizeInMegabytes { get; }
- bool RequiresDuplicateDetection { get; }
- TimeSpan DuplicateDetectionHistoryTimeWindow { get; }
- long SizeInBytes { get; }
- bool EnableBatchedOperations { get; }
- }
-
/// <summary>
/// value object, implementing equality of <see cref="PathBasedEntity.Path"/>.
/// </summary>
View
2 src/MassTransit.AzureServiceBus/Util/JetbrainsCodeAnnotations.cs
@@ -1,5 +1,7 @@
using System;
+#pragma warning disable 1591
+
namespace MassTransit.AzureServiceBus.Util
{
/*
View
2 src/MassTransit.Transports.AzureServiceBus.Tests/Azure_management_impl_spec.cs
@@ -16,7 +16,7 @@ public void management_purges_queue()
{
address = TestDataFactory.GetAddress();
- new AzureManagementImpl(true, address)
+ new PurgeImpl(true, address)
.Purge()
.Wait();
}
View
2 ...nsit.Transports.AzureServiceBus.Tests/MassTransit.Transports.AzureServiceBus.Tests.csproj
@@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1685</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1685</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Magnum, Version=2.0.0.4, Culture=neutral, processorArchitecture=MSIL">
View
2 src/MassTransit.Transports.AzureServiceBus.Tests/Publish_roundtrip_spec.cs
@@ -46,7 +46,7 @@ public void A_message_is_published()
//PipelineViewer.Trace(LocalBus.OutboundPipeline);
// wait on the inbound to become ready so that it starts accepting subscriptions
- LocalBus.Endpoint.InboundTransport.Receive(c => cc => { }, TimeSpan.MaxValue);
+ LocalBus.Endpoint.InboundTransport.Receive(c => cc => { }, 1.Milliseconds());
LocalBus.Publish(new A
{
View
8 src/MassTransit.Transports.AzureServiceBus.Tests/Publish_spec.cs
@@ -67,7 +67,7 @@ public void an_interface_based_message_is_published()
});
// wait for the inbound transport to become ready before publishing
- SubscriberBus.Endpoint.InboundTransport.Receive(c1 => c2 => { }, TimeSpan.MaxValue);
+ SubscriberBus.Endpoint.InboundTransport.Receive(c1 => c2 => { }, 1.Milliseconds());
correlationId = CombGuid.Generate();
PublisherBus.Publish<CorrelatedSwedishRat>(new CorrImpl(correlationId, "meek"));
@@ -125,14 +125,14 @@ public void an_interface_based_message_is_published()
});
// wait for the inbound transport to become ready before publishing
- SubscriberBus.Endpoint.InboundTransport.Receive(c1 => c2 => { }, TimeSpan.MaxValue);
+ SubscriberBus.Endpoint.InboundTransport.Receive(c1 => c2 => { }, 1.Milliseconds());
PublisherBus.Publish<TMesg>(new
{
SoundsLike = "peep"
});
- _receivedAnyRat.WaitUntilCompleted(15.Seconds()).ShouldBeTrue();
+ _receivedAnyRat.WaitUntilCompleted(20.Seconds()).ShouldBeTrue();
}
protected IServiceBus PublisherBus { get; private set; }
@@ -270,7 +270,7 @@ public void an_interface_based_message_is_published()
});
// wait for the inbound transport to become ready before publishing
- SubscriberBus.Endpoint.InboundTransport.Receive(c1 => c2 => { }, TimeSpan.MaxValue);
+ SubscriberBus.Endpoint.InboundTransport.Receive(c1 => c2 => { }, 1.Milliseconds());
PublisherBus.Publish<SpecialSwedishRat>(new DanneDenGråafläckigaRåttan
{
View
6 src/MassTransit.Transports.AzureServiceBus/AzureMessageNameFormatter.cs
@@ -23,11 +23,17 @@ public class AzureMessageNameFormatter
{
readonly DefaultMessageNameFormatter _formatter;
+ /// <summary>
+ /// c'tor
+ /// </summary>
public AzureMessageNameFormatter()
{
_formatter = new DefaultMessageNameFormatter("....", "--", "..", "-");
}
+ /// <summary>
+ /// Get the message name from the type of message
+ /// </summary>
public MessageName GetMessageName(Type type)
{
return _formatter.GetMessageName(type);
View
5 src/MassTransit.Transports.AzureServiceBus/AzureServiceBusEndpointAddressImpl.cs
@@ -11,8 +11,13 @@
using QueueDescription = MassTransit.AzureServiceBus.QueueDescription;
using TopicDescription = MassTransit.AzureServiceBus.TopicDescription;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
+ /// <summary>
+ /// implemntation, see <see cref="AzureServiceBusEndpointAddress"/>.
+ /// </summary>
public class AzureServiceBusEndpointAddressImpl
: AzureServiceBusEndpointAddress
{
View
2 ...MassTransit.Transports.AzureServiceBus/Configuration/AzureManagementEndpointManagement.cs
@@ -3,6 +3,8 @@
using MassTransit.Async;
using MassTransit.AzureServiceBus;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus.Configuration
{
/// <summary>
View
111 ...ransit.Transports.AzureServiceBus/Configuration/AzureServiceBusFactoryConfiguratorImpl.cs
@@ -1,46 +1,8 @@
using System;
-using MassTransit.AzureServiceBus;
+using MassTransit.AzureServiceBus.Util;
namespace MassTransit.Transports.AzureServiceBus.Configuration
{
- public class AzureAzureServiceBusFactoryConfiguratorImpl
- : AzureServiceBusFactoryConfigurator
- {
- private readonly ReceiverSettingsImpl _settings = new ReceiverSettingsImpl();
-
- public ITransportFactory Build()
- {
- //var tokenProvider = ConfigFactory.CreateTokenProvider();
- return new TransportFactoryImpl(_settings);
- }
-
- public void SetLockDuration(TimeSpan lockDuration)
- {
- }
-
- public void SetDefaultMessageTimeToLive(TimeSpan ttl)
- {
- }
-
- public void SetDeadLetteringOnExpiration(bool enabled)
- {
- }
-
- public void SetBatchedOperations(bool enabled)
- {
- }
-
- public void SetReceiveTimeout(TimeSpan timeout)
- {
- _settings.ReceiveTimeout = timeout;
- }
-
- public void SetReceiverName(string name)
- {
- _settings.ReceiverName = name;
- }
- }
-
/// <summary>
/// Interface for users to configure the transport with
/// </summary>
@@ -76,8 +38,12 @@ public interface AzureServiceBusFactoryConfigurator
void SetBatchedOperations(bool enabled);
/// <summary>
- /// Sets the name for subscriptions.
+ /// Set the receiver name (this corresponds to the name of the subscription created on topics
+ /// in Azure ServiceBus. Setting this equal to what another bus has, allows your
+ /// bus to do competing consumes on all message types that it consumes.
/// </summary>
+ /// <exception cref="ArgumentException">name.trim() is an empty string</exception>
+ /// <param name="name">Name to use for subscriptions.</param>
void SetReceiverName(string name);
/// <summary>
@@ -85,4 +51,69 @@ public interface AzureServiceBusFactoryConfigurator
/// </summary>
void SetReceiveTimeout(TimeSpan timeout);
}
+
+#pragma warning disable 1591
+
+ /// <summary>
+ /// See <see cref="AzureServiceBusFactoryConfigurator"/>.
+ /// </summary>
+ public class AzureAzureServiceBusFactoryConfiguratorImpl
+ : AzureServiceBusFactoryConfigurator
+ {
+ private readonly ReceiverSettingsImpl _settings = new ReceiverSettingsImpl();
+
+ static Logging.ILog _logger = Logging.Logger.Get<AzureAzureServiceBusFactoryConfiguratorImpl>();
+
+ /// <summary>
+ /// Actually build the transport factory.
+ /// </summary>
+ /// <returns>An instance of the transport factory</returns>
+ [NotNull]
+ public ITransportFactory Build()
+ {
+ _logger.Debug("building transport factory");
+ //var tokenProvider = ConfigFactory.CreateTokenProvider();
+ return new TransportFactoryImpl(_settings);
+ }
+
+ public void SetLockDuration(TimeSpan lockDuration)
+ {
+ MissingSetting("SetLockDuration");
+ }
+
+ public void SetDefaultMessageTimeToLive(TimeSpan ttl)
+ {
+ MissingSetting("SetDefaultMessageTimeToLive");
+ }
+
+ public void SetDeadLetteringOnExpiration(bool enabled)
+ {
+ MissingSetting("SetDeadLetteringOnExpiration");
+ }
+
+ public void SetBatchedOperations(bool enabled)
+ {
+ MissingSetting("SetBatchedOperations");
+ }
+
+ static void MissingSetting(string setting)
+ {
+ _logger.Warn(string.Format("Setting {0} is currently not implemented", setting));
+ }
+
+ public void SetReceiveTimeout(TimeSpan timeout)
+ {
+ _logger.DebugFormat("setting ReceiveTimeout to {0}", timeout);
+ _settings.ReceiveTimeout = timeout;
+ }
+
+ public void SetReceiverName([NotNull] string name)
+ {
+ if (name == null) throw new ArgumentNullException("name");
+ if (name.Trim() == "") throw new ArgumentException("name mustn't be empty", "name");
+
+ _logger.DebugFormat("setting ReceiverName to {0}", name);
+ _settings.ReceiverName = name;
+ }
+ }
}
View
25 ...ssTransit.Transports.AzureServiceBus/Configuration/AzureServiceBusServiceBusExtensions.cs
@@ -1,8 +1,11 @@
-using Magnum.Extensions;
+using System;
+using Magnum.Extensions;
using MassTransit.AzureServiceBus.Util;
using MassTransit.BusConfigurators;
using MassTransit.Pipeline.Configuration;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus.Configuration
{
public static class AzureServiceBusServiceBusExtensions
@@ -12,20 +15,28 @@ public static class AzureServiceBusServiceBusExtensions
/// uri by means of its components.
/// </summary>
public static void ReceiveFromComponents<T>(this T configurator,
- string issuerOrUsername,
- string defaultKeyOrPassword, string serviceBusNamespace,
- string application)
+ [NotNull] string issuerOrUsername,
+ [NotNull] string defaultKeyOrPassword,
+ [NotNull] string serviceBusNamespace,
+ [NotNull] string application)
where T : ServiceBusConfigurator
{
+ if (issuerOrUsername == null) throw new ArgumentNullException("issuerOrUsername");
+ if (defaultKeyOrPassword == null) throw new ArgumentNullException("defaultKeyOrPassword");
+ if (serviceBusNamespace == null) throw new ArgumentNullException("serviceBusNamespace");
+ if (application == null) throw new ArgumentNullException("application");
var credentials = new Credentials(issuerOrUsername, defaultKeyOrPassword, serviceBusNamespace, application);
configurator.ReceiveFrom(credentials.BuildUri());
}
- [UsedImplicitly] // in public API
- public static void ReceiveFromComponents<T>(this T configurator,
- PreSharedKeyCredentials creds)
+ /// <summary>
+ /// Configure MassTransit to consume from Azure Service Bus.
+ /// </summary>
+ public static void ReceiveFromComponents<T>(this T configurator,
+ [NotNull] PreSharedKeyCredentials creds)
where T : ServiceBusConfigurator
{
+ if (creds == null) throw new ArgumentNullException("creds");
configurator.ReceiveFrom(creds.BuildUri());
}
View
2 src/MassTransit.Transports.AzureServiceBus/Configuration/Credentials.cs
@@ -14,6 +14,8 @@
using System;
using Magnum.Extensions;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus.Configuration
{
/// <summary>
View
4 ...Transit.Transports.AzureServiceBus/Configuration/EndpointFactoryConfiguratorExtensions.cs
@@ -2,6 +2,8 @@
using MassTransit.AzureServiceBus.Util;
using MassTransit.EndpointConfigurators;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus.Configuration
{
public static class EndpointFactoryConfiguratorExtensions
@@ -28,7 +30,7 @@ public static T UseAzureServiceBus<T>(this T configurator)
var tfacCfg = new AzureAzureServiceBusFactoryConfiguratorImpl();
configure(tfacCfg);
-
+
configurator.AddTransportFactory(tfacCfg.Build);
configurator.UseJsonSerializer();
View
15 src/MassTransit.Transports.AzureServiceBus/Configuration/PreSharedKeyCredentials.cs
@@ -21,9 +21,24 @@ namespace MassTransit.Transports.AzureServiceBus.Configuration
/// </summary>
public interface PreSharedKeyCredentials
{
+ /// <summary>
+ /// Gets the issuer name as specified by Azure.
+ /// </summary>
string IssuerName { get; }
+
+ /// <summary>
+ /// Gets the base64-encoded key for the service as specified by Azure.
+ /// </summary>
string Key { get; }
+
+ /// <summary>
+ /// Gets the namespace for the service as specified by Azure.
+ /// </summary>
string Namespace { get; }
+
+ /// <summary>
+ /// What application is under authorization?
+ /// </summary>
string Application { get; }
/// <summary>
View
8 src/MassTransit.Transports.AzureServiceBus/Configuration/PublishEndpointInterceptor.cs
@@ -10,6 +10,10 @@
namespace MassTransit.Transports.AzureServiceBus.Configuration
{
+ /// <summary>
+ /// Interceptor for bus.Publish calls; look in the endpoints of the bus for
+ /// endpoints of the published message type. Highly cohesive with <see cref="PublishEndpointSinkLocator"/>.
+ /// </summary>
public class PublishEndpointInterceptor : IOutboundMessageInterceptor
{
readonly ServiceBus _bus;
@@ -17,6 +21,10 @@ public class PublishEndpointInterceptor : IOutboundMessageInterceptor
readonly AzureServiceBusEndpointAddress _address;
readonly Dictionary<Type, UnsubscribeAction> _added;
+ /// <summary>
+ /// c'tor
+ /// </summary>
+ /// <param name="bus"></param>
public PublishEndpointInterceptor([NotNull] ServiceBus bus)
{
if (bus == null) throw new ArgumentNullException("bus");
View
8 src/MassTransit.Transports.AzureServiceBus/Configuration/PublishEndpointSinkLocator.cs
@@ -1,5 +1,6 @@
using System;
using MassTransit.AzureServiceBus;
+using MassTransit.AzureServiceBus.Util;
using MassTransit.Pipeline.Inspectors;
using MassTransit.Pipeline.Sinks;
@@ -15,8 +16,13 @@ public class PublishEndpointSinkLocator :
readonly AzureServiceBusEndpointAddress _endpointAddress;
readonly Type _messageType;
- public PublishEndpointSinkLocator(Type messageType, AzureServiceBusEndpointAddress endpointAddress)
+ /// <summary>
+ /// c'tor
+ /// </summary>
+ public PublishEndpointSinkLocator([NotNull] Type messageType, [NotNull] AzureServiceBusEndpointAddress endpointAddress)
{
+ if (messageType == null) throw new ArgumentNullException("messageType");
+ if (endpointAddress == null) throw new ArgumentNullException("endpointAddress");
_endpointAddress = endpointAddress;
_messageType = messageType;
}
View
3 src/MassTransit.Transports.AzureServiceBus/ConnectionImpl.cs
@@ -18,10 +18,11 @@
using MassTransit.Logging;
using MassTransit.Transports.AzureServiceBus.Internal;
using MassTransit.Transports.AzureServiceBus.Management;
-using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using MessageSender = MassTransit.AzureServiceBus.MessageSender;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
/// <summary>
View
3 src/MassTransit.Transports.AzureServiceBus/Constants.cs
@@ -10,6 +10,9 @@
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
+
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
public static class Constants
View
2 src/MassTransit.Transports.AzureServiceBus/InboundTransportImpl.cs
@@ -23,6 +23,8 @@
using Microsoft.ServiceBus.Messaging;
using TopicDescription = MassTransit.AzureServiceBus.TopicDescription;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
/// <summary>
View
2 src/MassTransit.Transports.AzureServiceBus/Internal/TaskExtensions.cs
@@ -7,7 +7,7 @@ namespace MassTransit.Transports.AzureServiceBus.Internal
/// <summary>
/// Docs: http://blogs.msdn.com/b/pfxteam/archive/2010/11/21/10094564.aspx
/// </summary>
- public static class TaskExtensions
+ internal static class TaskExtensions
{
class Unit
{
View
3 src/MassTransit.Transports.AzureServiceBus/Management/AzureManagement.cs
@@ -12,6 +12,9 @@
// specific language governing permissions and limitations under the License.
namespace MassTransit.Transports.AzureServiceBus.Management
{
+ /// <summary>
+ /// Handles resourcse on connection binding and unbinding.
+ /// </summary>
public interface AzureManagement
: ConnectionBinding<ConnectionImpl>
{
View
6 src/MassTransit.Transports.AzureServiceBus/Management/NamespaceManagerExtensions.cs
@@ -27,6 +27,9 @@ namespace MassTransit.Transports.AzureServiceBus.Management
/// </summary>
public static class NamespaceManagerExtensions
{
+ /// <summary>
+ /// Asynchronously create a new message sender.
+ /// </summary>
public static Task<MessageSender> TryCreateMessageSender(
[NotNull] this MessagingFactory mf,
[NotNull] QueueDescription description,
@@ -43,6 +46,9 @@ public static class NamespaceManagerExtensions
});
}
+ /// <summary>
+ /// Asynchronously create a new message sender.
+ /// </summary>
public static Task<MessageSender> TryCreateMessageSender(
[NotNull] this MessagingFactory mf,
[NotNull] TopicDescription description)
View
11 ...viceBus/Management/AzureManagementImpl.cs → ...s.AzureServiceBus/Management/PurgeImpl.cs
@@ -18,17 +18,22 @@
using MassTransit.AzureServiceBus.Util;
using MassTransit.Logging;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus.Management
{
- public class AzureManagementImpl
+ /// <summary>
+ /// Handles queue connection purging.
+ /// </summary>
+ public class PurgeImpl
: AzureManagement
{
- static readonly ILog _logger = Logger.Get(typeof (AzureManagementImpl));
+ static readonly ILog _logger = Logger.Get(typeof (PurgeImpl));
readonly bool _purgeExistingMessages;
readonly AzureServiceBusEndpointAddress _address;
- public AzureManagementImpl(bool purgeExistingMessages,
+ public PurgeImpl(bool purgeExistingMessages,
[NotNull] AzureServiceBusEndpointAddress address)
{
if (address == null)
View
4 src/MassTransit.Transports.AzureServiceBus/MassTransit.Transports.AzureServiceBus.csproj
@@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Debug\MassTransit.Transports.AzureServiceBus.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Release\MassTransit.Transports.AzureServiceBus.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Magnum, Version=2.0.0.4, Culture=neutral, processorArchitecture=MSIL">
@@ -68,7 +70,7 @@
<Compile Include="Internal\EndpointAsyncLoggerExtensions.cs" />
<Compile Include="Internal\TaskExtensions.cs" />
<Compile Include="Management\AzureManagement.cs" />
- <Compile Include="Management\AzureManagementImpl.cs" />
+ <Compile Include="Management\PurgeImpl.cs" />
<Compile Include="MessageEnvelope.cs" />
<Compile Include="AzureMessageNameFormatter.cs" />
<Compile Include="OutboundTransportImpl.cs" />
View
6 src/MassTransit.Transports.AzureServiceBus/MessageEnvelope.cs
@@ -9,6 +9,9 @@ namespace MassTransit.Transports.AzureServiceBus
[Serializable]
public class MessageEnvelope
{
+ /// <summary>
+ /// c'tor
+ /// </summary>
public MessageEnvelope([NotNull] byte[] actualBody)
{
if (actualBody == null) throw new ArgumentNullException("actualBody");
@@ -21,6 +24,9 @@ protected MessageEnvelope()
{
}
+ /// <summary>
+ /// Gets the actual byte[] of the body.
+ /// </summary>
public byte[] ActualBody { get; protected set; }
}
}
View
44 src/MassTransit.Transports.AzureServiceBus/OutboundTransportImpl.cs
@@ -1,3 +1,16 @@
+// Copyright 2012 Henrik Feldt
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+
using System;
using System.Collections.Generic;
using System.IO;
@@ -7,22 +20,23 @@
using MassTransit.AzureServiceBus;
using MassTransit.AzureServiceBus.Util;
using MassTransit.Logging;
-using Microsoft.ServiceBus.Messaging;
-using ILog = MassTransit.Logging.ILog;
using MassTransit.Transports.AzureServiceBus.Internal;
+using Microsoft.ServiceBus.Messaging;
using MessageSender = MassTransit.AzureServiceBus.MessageSender;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
/// <summary>
- /// Outbound transport targeting the azure service bus.
+ /// Outbound transport targeting the azure service bus.
/// </summary>
public class OutboundTransportImpl
: IOutboundTransport
{
const int MaxOutstanding = 100;
const string BusyRetriesKey = "busy-retries";
- static readonly ILog _logger = Logger.Get(typeof(OutboundTransportImpl));
+ static readonly ILog _logger = Logger.Get(typeof (OutboundTransportImpl));
bool _disposed;
@@ -35,6 +49,9 @@ public class OutboundTransportImpl
readonly ConnectionHandler<ConnectionImpl> _connectionHandler;
readonly AzureServiceBusEndpointAddress _address;
+ /// <summary>
+ /// c'tor
+ /// </summary>
public OutboundTransportImpl(
[NotNull] AzureServiceBusEndpointAddress address,
[NotNull] ConnectionHandler<ConnectionImpl> connectionHandler)
@@ -56,10 +73,15 @@ public void Dispose()
_address.Dispose();
_connectionHandler.Dispose();
}
- finally { _disposed = true; }
+ finally
+ {
+ _disposed = true;
+ }
}
- /// <summary>Gets the endpoint address this transport sends to.</summary>
+ /// <summary>
+ /// Gets the endpoint address this transport sends to.
+ /// </summary>
public IEndpointAddress Address
{
get { return _address; }
@@ -76,13 +98,13 @@ public void Send(ISendContext context)
{
context.SerializeTo(body);
var bm = new BrokeredMessage(new MessageEnvelope(body.ToArray()));
-
+
if (!string.IsNullOrWhiteSpace(context.CorrelationId))
bm.CorrelationId = context.CorrelationId;
-
+
if (!string.IsNullOrWhiteSpace(context.MessageId))
bm.MessageId = context.MessageId;
-
+
TrySendMessage(connection, bm);
}
});
@@ -94,7 +116,7 @@ void TrySendMessage(ConnectionImpl connection, BrokeredMessage message)
SpinWait.SpinUntil(() => _messagesInFlight < MaxOutstanding);
Address.LogBeginSend(message.MessageId);
-
+
Interlocked.Increment(ref _messagesInFlight);
connection.MessageSender.BeginSend(message, ar =>
@@ -134,7 +156,7 @@ void TrySendMessage(ConnectionImpl connection, BrokeredMessage message)
}
// call only if first time gotten server busy exception
- private void RetryLoop(ConnectionImpl connection, BrokeredMessage bm)
+ void RetryLoop(ConnectionImpl connection, BrokeredMessage bm)
{
Address.LogSendRetryScheduled(bm.MessageId, _messagesInFlight, Interlocked.Increment(ref _sleeping));
// exception tells me to wait 10 seconds before retrying, so let's sleep 1 second instead,
View
24 src/MassTransit.Transports.AzureServiceBus/PerConnectionReceiver.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using MassTransit.Async;
using MassTransit.AzureServiceBus;
using MassTransit.AzureServiceBus.Util;
@@ -42,11 +41,14 @@ class PerConnectionReceiver
_onUnbound = onUnbound;
}
+ /// <summary>
+ /// Normal Receiver is started
+ /// </summary>
public void Bind(ConnectionImpl connection)
{
_logger.DebugFormat("starting receiver for '{0}'", _address);
- if (_receiver != null)
+ if (_receiver != null)
return;
_receiver = ReceiverModule.StartReceiver(_address, _settings);
@@ -54,6 +56,9 @@ public void Bind(ConnectionImpl connection)
_onBound(_receiver);
}
+ /// <summary>
+ /// Normal Receiver is stopped/disposed
+ /// </summary>
public void Unbind(ConnectionImpl connection)
{
_logger.DebugFormat("stopping receiver for '{0}'", _address);
@@ -67,6 +72,9 @@ public void Unbind(ConnectionImpl connection)
_receiver = null;
}
+ /// <summary>
+ /// Get a message from the queue (in memory one)
+ /// </summary>
public BrokeredMessage Get(TimeSpan timeout)
{
if (_receiver == null)
@@ -74,17 +82,5 @@ public BrokeredMessage Get(TimeSpan timeout)
return _receiver.Get(timeout);
}
-
- public void SubscribeTopic([NotNull] TopicDescription value)
- {
- if (value == null) throw new ArgumentNullException("value");
- _receiver.Subscribe(value);
- }
-
- public void UnsubscribeTopic([NotNull] TopicDescription value)
- {
- if (value == null) throw new ArgumentNullException("value");
- _receiver.Unsubscribe(value);
- }
}
}
View
5 src/MassTransit.Transports.AzureServiceBus/QueueDescriptionImpl.cs
@@ -15,8 +15,13 @@
using System.Runtime.Serialization;
using MassTransit.AzureServiceBus;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
+ /// <summary>
+ /// See <see cref="QueueDescription"/>
+ /// </summary>
public class QueueDescriptionImpl : QueueDescription
{
readonly Microsoft.ServiceBus.Messaging.QueueDescription _inner;
View
13 src/MassTransit.Transports.AzureServiceBus/Testing/AzureServiceBusScenarioBuilder.cs
@@ -2,6 +2,8 @@
using MassTransit.Testing.ScenarioBuilders;
using MassTransit.Transports.AzureServiceBus.Configuration;
+#pragma warning disable 1591
+
namespace MassTransit.Testing
{
public class AzureServiceBusScenarioBuilder
@@ -10,15 +12,8 @@ public class AzureServiceBusScenarioBuilder
public AzureServiceBusScenarioBuilder([NotNull] PreSharedKeyCredentials credentials)
: base(credentials.BuildUri())
{
- ConfigureEndpointFactory(x =>
- {
- x.UseAzureServiceBus();
- });
-
- ConfigureBus(x =>
- {
- x.UseAzureServiceBusRouting();
- });
+ ConfigureEndpointFactory(x => x.UseAzureServiceBus());
+ ConfigureBus(x => x.UseAzureServiceBusRouting());
}
}
}
View
10 src/MassTransit.Transports.AzureServiceBus/Testing/BusTestScenarioExtensions.cs
@@ -16,14 +16,22 @@
using MassTransit.Testing.TestInstanceConfigurators;
using MassTransit.Transports.AzureServiceBus.Configuration;
+#pragma warning disable 1591
+// ReSharper disable CheckNamespace
+
namespace MassTransit.Testing
{
public static class BusTestScenarioExtensions
{
+ /// <summary>
+ /// Create a new testing scenario with Azure Service Bus.
+ /// Note: currently recommended to use the loopback scenario builder.
+ /// </summary>
public static void UseAzureServiceBusBusScenario(
- this TestInstanceConfigurator<BusTestScenario> configurator,
+ [NotNull] this TestInstanceConfigurator<BusTestScenario> configurator,
[NotNull] PreSharedKeyCredentials credentials)
{
+ if (configurator == null) throw new ArgumentNullException("configurator");
if (credentials == null) throw new ArgumentNullException("credentials");
configurator.UseScenarioBuilder(() => new AzureServiceBusScenarioBuilder(credentials));
}
View
5 src/MassTransit.Transports.AzureServiceBus/TopicDescriptionImpl.cs
@@ -2,8 +2,13 @@
using System.Runtime.Serialization;
using MassTransit.AzureServiceBus;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
+ /// <summary>
+ /// See <see cref="TopicDescription"/>
+ /// </summary>
public class TopicDescriptionImpl : TopicDescription
{
readonly Microsoft.ServiceBus.Messaging.TopicDescription _description;
View
2 src/MassTransit.Transports.AzureServiceBus/TopicSubscriptionObserver.cs
@@ -20,6 +20,8 @@
using MassTransit.Subscriptions.Messages;
using Magnum.Extensions;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
/// <summary>
View
85 src/MassTransit.Transports.AzureServiceBus/TransportFactoryImpl.cs
@@ -1,3 +1,16 @@
+// Copyright 2012 Henrik Feldt
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+
using System;
using Magnum.Extensions;
using Magnum.Threading;
@@ -8,26 +21,36 @@
using MassTransit.Transports.AzureServiceBus.Configuration;
using MassTransit.Transports.AzureServiceBus.Management;
+#pragma warning disable 1591
+
namespace MassTransit.Transports.AzureServiceBus
{
+ /// <summary>
+ /// Implementation of the transport factory
+ /// </summary>
public class TransportFactoryImpl
: ITransportFactory
{
static readonly ILog _logger = Logger.Get(typeof (TransportFactoryImpl));
- private readonly ReaderWriterLockedDictionary<Uri, ConnectionHandler<ConnectionImpl>> _connCache;
- private readonly ReaderWriterLockedDictionary<Uri, AzureServiceBusEndpointAddress> _addresses;
- private readonly AzureMessageNameFormatter _formatter;
- private bool _disposed;
+ readonly ReaderWriterLockedDictionary<Uri, ConnectionHandler<ConnectionImpl>> _connCache;
+ readonly ReaderWriterLockedDictionary<Uri, AzureServiceBusEndpointAddress> _addresses;
+ readonly AzureMessageNameFormatter _formatter;
+ bool _disposed;
- private readonly ReceiverSettings _settings;
+ readonly ReceiverSettings _settings;
+ /// <summary>
+ /// c'tor
+ /// </summary>
public TransportFactoryImpl()
: this(new ReceiverSettingsImpl())
{
-
}
+ /// <summary>
+ /// c'tor taking settings to configure the endpoint with
+ /// </summary>
public TransportFactoryImpl(ReceiverSettings settings)
{
_addresses = new ReaderWriterLockedDictionary<Uri, AzureServiceBusEndpointAddress>();
@@ -47,6 +70,9 @@ public string Scheme
get { return Constants.Scheme; }
}
+ /// <summary>
+ /// The message name formatter associated with this transport
+ /// </summary>
public IMessageNameFormatter MessageNameFormatter
{
get { return _formatter; }
@@ -59,7 +85,7 @@ public IMessageNameFormatter MessageNameFormatter
/// <returns> </returns>
public IDuplexTransport BuildLoopback([NotNull] ITransportSettings settings)
{
- if (settings == null)
+ if (settings == null)
throw new ArgumentNullException("settings");
_logger.Debug("building duplex transport");
@@ -67,23 +93,39 @@ public IDuplexTransport BuildLoopback([NotNull] ITransportSettings settings)
return new Transport(settings.Address, () => BuildInbound(settings), () => BuildOutbound(settings));
}
- public virtual IInboundTransport BuildInbound(ITransportSettings settings)
+ /// <summary>
+ /// Builds the inbound transport for the service bus endpoint,
+ /// </summary>
+ /// <param name="settings"> using these settings </param>
+ /// <returns> A non-null instance of the inbound transport. </returns>
+ public virtual IInboundTransport BuildInbound([NotNull] ITransportSettings settings)
{
+ if (settings == null) throw new ArgumentNullException("settings");
+
EnsureProtocolIsCorrect(settings.Address.Uri);
- var address = _addresses.Retrieve(settings.Address.Uri, () => AzureServiceBusEndpointAddressImpl.Parse(settings.Address.Uri));
+ var address = _addresses.Retrieve(settings.Address.Uri,
+ () => AzureServiceBusEndpointAddressImpl.Parse(settings.Address.Uri));
_logger.DebugFormat("building inbound transport for address '{0}'", address);
var client = GetConnection(address);
- return new InboundTransportImpl(address, client, new AzureManagementImpl(settings.PurgeExistingMessages, address), MessageNameFormatter, _settings);
+ return new InboundTransportImpl(address, client, new PurgeImpl(settings.PurgeExistingMessages, address),
+ MessageNameFormatter, _settings);
}
- public virtual IOutboundTransport BuildOutbound(ITransportSettings settings)
+ /// <summary>
+ /// Builds the outbound transport
+ /// </summary>
+ /// <param name="settings"> with settings </param>
+ /// <returns> The outbound transport instance, non-null </returns>
+ public virtual IOutboundTransport BuildOutbound([NotNull] ITransportSettings settings)
{
+ if (settings == null) throw new ArgumentNullException("settings");
EnsureProtocolIsCorrect(settings.Address.Uri);
- var address = _addresses.Retrieve(settings.Address.Uri, () => AzureServiceBusEndpointAddressImpl.Parse(settings.Address.Uri));
+ var address = _addresses.Retrieve(settings.Address.Uri,
+ () => AzureServiceBusEndpointAddressImpl.Parse(settings.Address.Uri));
_logger.DebugFormat("building outbound transport for address '{0}'", address);
var client = GetConnection(address);
@@ -91,11 +133,18 @@ public virtual IOutboundTransport BuildOutbound(ITransportSettings settings)
return new OutboundTransportImpl(address, client);
}
- public virtual IOutboundTransport BuildError(ITransportSettings settings)
+ /// <summary>
+ /// Builds the outbound error transport; where to send messages that fail.
+ /// </summary>
+ /// <param name="settings"> using these settings </param>
+ /// <returns> The outbound transport instance, non null </returns>
+ public virtual IOutboundTransport BuildError([NotNull] ITransportSettings settings)
{
+ if (settings == null) throw new ArgumentNullException("settings");
EnsureProtocolIsCorrect(settings.Address.Uri);
- var address = _addresses.Retrieve(settings.Address.Uri, () => AzureServiceBusEndpointAddressImpl.Parse(settings.Address.Uri));
+ var address = _addresses.Retrieve(settings.Address.Uri,
+ () => AzureServiceBusEndpointAddressImpl.Parse(settings.Address.Uri));
_logger.DebugFormat("building error transport for address '{0}'", address);
var client = GetConnection(address);
@@ -106,15 +155,17 @@ public virtual IOutboundTransport BuildError(ITransportSettings settings)
/// Ensures the protocol is correct.
/// </summary>
/// <param name="address"> The address. </param>
- private void EnsureProtocolIsCorrect(Uri address)
+ void EnsureProtocolIsCorrect([NotNull] Uri address)
{
+ if (address == null) throw new ArgumentNullException("address");
if (address.Scheme != Scheme)
throw new EndpointException(address,
- string.Format("Address must start with 'stomp' not '{0}'", address.Scheme));
+ string.Format("Address must start with 'stomp' not '{0}'", address.Scheme));
}
- private ConnectionHandler<ConnectionImpl> GetConnection(AzureServiceBusEndpointAddress address)
+ ConnectionHandler<ConnectionImpl> GetConnection([NotNull] AzureServiceBusEndpointAddress address)
{
+ if (address == null) throw new ArgumentNullException("address");
_logger.DebugFormat("get connection( address:'{0}' )", address);
return _connCache.Retrieve(address.Uri, () =>
View
2 ...esting/MassTransit.AzurePerformance.Messages/MassTransit.AzurePerformance.Messages.csproj
@@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
View
2 ...esting/MassTransit.AzurePerformance.Receiver/MassTransit.AzurePerformance.Receiver.csproj
@@ -23,6 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1685;1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -31,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1685;1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Magnum, Version=2.0.0.4, Culture=neutral, processorArchitecture=MSIL">
View
2 ...nceTesting/MassTransit.AzurePerformance.Sender/MassTransit.AzurePerformance.Sender.csproj
@@ -23,6 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1685;1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -31,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <NoWarn>1685</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Magnum, Version=2.0.0.4, Culture=neutral, processorArchitecture=MSIL">
View
5 src/PerformanceTesting/Utils/Utils.fsproj
@@ -21,7 +21,7 @@
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
- <DocumentationFile>bin\Debug\Utils.XML</DocumentationFile>
+ <DocumentationFile>bin\Debug\Utils.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,7 +30,7 @@
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
- <DocumentationFile>bin\Release\Utils.XML</DocumentationFile>
+ <DocumentationFile>bin\Release\Utils.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
@@ -44,7 +44,6 @@
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets" Condition="!Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')" />
-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

0 comments on commit e7f2947

Please sign in to comment.
Something went wrong with that request. Please try again.