diff --git a/.gitattributes b/.gitattributes
deleted file mode 100755
index 412eeda..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,22 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto
-
-# Custom for Visual Studio
-*.cs diff=csharp
-*.sln merge=union
-*.csproj merge=union
-*.vbproj merge=union
-*.fsproj merge=union
-*.dbproj merge=union
-
-# Standard to msysgit
-*.doc diff=astextplain
-*.DOC diff=astextplain
-*.docx diff=astextplain
-*.DOCX diff=astextplain
-*.dot diff=astextplain
-*.DOT diff=astextplain
-*.pdf diff=astextplain
-*.PDF diff=astextplain
-*.rtf diff=astextplain
-*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
deleted file mode 100755
index cadfa3e..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,29 +0,0 @@
-[Oo]bj
-[Bb]in
-*.user
-*.suo
-*.[Cc]ache
-*.bak
-*.ncb
-*.log
-*.DS_Store
-[Tt]humbs.db
-_ReSharper.*
-
-# Ignore NCrunch cache files.
-*.crunchproject.local.xml
-*.crunchsolution.local.xml
-*.ncrunchproject
-*.ncrunchsolution
-
-# Ignore test output
-TestResult.xml
-
-# Ignore NuGet package files.
-*.nupkg
-
-*.userprefs
-test-results
-
-# NuGet Packages Directory
-packages
\ No newline at end of file
diff --git a/AzureNetQ.Tests.Messages/AzureNetQ.Tests.Messages.csproj b/AzureNetQ.Tests.Messages/AzureNetQ.Tests.Messages.csproj
deleted file mode 100644
index b16f5b8..0000000
--- a/AzureNetQ.Tests.Messages/AzureNetQ.Tests.Messages.csproj
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {FD277901-413F-4064-8A38-57A3609872CB}
- Library
- Properties
- AzureNetQ.Tests.Messages
- AzureNetQ.Tests.Messages
- v4.0
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- true
- bin\DebugCloud\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.Messages/Messages.cs b/AzureNetQ.Tests.Messages/Messages.cs
deleted file mode 100644
index 2b91272..0000000
--- a/AzureNetQ.Tests.Messages/Messages.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-namespace AzureNetQ.Tests.Messages
-{
- using System;
-
- [Serializable]
- public class TestRequestMessage
- {
- public long Id { get; set; }
- public string Text { get; set; }
- public bool CausesExceptionInServer { get; set; }
- public string ExceptionInServerMessage { get; set; }
- public bool CausesServerToTakeALongTimeToRespond { get; set; }
- }
-
- [Serializable]
- public class TestResponseMessage
- {
- public long Id { get; set; }
- public string Text { get; set; }
- }
-
- [Serializable]
- public class TestAsyncRequestMessage
- {
- public long Id { get; set; }
- public string Text { get; set; }
- }
-
- [Serializable]
- public class TestAsyncResponseMessage
- {
- public long Id { get; set; }
- public string Text { get; set; }
- }
-}
diff --git a/AzureNetQ.Tests.Messages/Properties/AssemblyInfo.cs b/AzureNetQ.Tests.Messages/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1c39eea..0000000
--- a/AzureNetQ.Tests.Messages/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AzureNetQ.Tests.Messages")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AzureNetQ.Tests.Messages")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("a52e0c56-48be-4c07-87fc-01c83b7398b2")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AzureNetQ.Tests.PublishSubscribe/App.config b/AzureNetQ.Tests.PublishSubscribe/App.config
deleted file mode 100644
index 74ade9d..0000000
--- a/AzureNetQ.Tests.PublishSubscribe/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/AzureNetQ.Tests.PublishSubscribe/AzureNetQ.Tests.PublishSubscribe.csproj b/AzureNetQ.Tests.PublishSubscribe/AzureNetQ.Tests.PublishSubscribe.csproj
deleted file mode 100644
index b70da06..0000000
--- a/AzureNetQ.Tests.PublishSubscribe/AzureNetQ.Tests.PublishSubscribe.csproj
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}
- Exe
- Properties
- AzureNetQ.Tests.PublishSubscribe
- AzureNetQ.Tests.PublishSubscribe
- v4.0
- 512
-
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}
- AzureNetQ
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.PublishSubscribe/Program.cs b/AzureNetQ.Tests.PublishSubscribe/Program.cs
deleted file mode 100644
index d5f0bab..0000000
--- a/AzureNetQ.Tests.PublishSubscribe/Program.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-namespace AzureNetQ.Tests.PublishSubscribe
-{
- using System;
- using System.Threading.Tasks;
-
- using AzureNetQ.NonGeneric;
-
- public class Program
- {
- private IBus bus;
-
- public static void Main(string[] args)
- {
- new Program().Run();
- }
-
- private void Run()
- {
- this.bus = AzureBusFactory.CreateBus("Endpoint=sb://servicebus/ServiceBusDefaultNamespace;StsEndpoint=https://servicebus:10355/ServiceBusDefaultNamespace;RuntimePort=10354;ManagementPort=10355");
-
- this.bus.SubscribeAsync(
- typeof(TestMessage),
- obj => Task.Factory.StartNew(() => Console.WriteLine("Handler Received message: {0}", ((TestMessage)obj).Text)));
-
- Console.WriteLine("Type a message or 'q' to quit.");
-
- string text = null;
- while ((text = Console.ReadLine()) != "q")
- {
- this.bus.Publish(
- typeof(TestMessage),
- new TestMessage
- {
- Text = text
- });
- }
-
- this.bus.Dispose();
- }
- }
-
- [Serializable]
- public class TestMessage
- {
- public string Text { get; set; }
- }
-}
diff --git a/AzureNetQ.Tests.PublishSubscribe/Properties/AssemblyInfo.cs b/AzureNetQ.Tests.PublishSubscribe/Properties/AssemblyInfo.cs
deleted file mode 100644
index a95f88f..0000000
--- a/AzureNetQ.Tests.PublishSubscribe/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AzureNetQ.Tests.PublishSubscribe")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AzureNetQ.Tests.PublishSubscribe")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("597d801d-a1bc-4f7a-ab00-36eb16f671e0")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AzureNetQ.Tests.PublishSubscribe/Settings.StyleCop b/AzureNetQ.Tests.PublishSubscribe/Settings.StyleCop
deleted file mode 100644
index b49c38e..0000000
--- a/AzureNetQ.Tests.PublishSubscribe/Settings.StyleCop
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SendReceive/App.config b/AzureNetQ.Tests.SendReceive/App.config
deleted file mode 100644
index b3123c7..0000000
--- a/AzureNetQ.Tests.SendReceive/App.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SendReceive/AzureNetQ.Tests.SendReceive.csproj b/AzureNetQ.Tests.SendReceive/AzureNetQ.Tests.SendReceive.csproj
deleted file mode 100644
index fe7a92c..0000000
--- a/AzureNetQ.Tests.SendReceive/AzureNetQ.Tests.SendReceive.csproj
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}
- Exe
- Properties
- AzureNetQ.Tests.SendReceive
- AzureNetQ.Tests.SendReceive
- v4.5
- 512
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {fd277901-413f-4064-8a38-57a3609872cb}
- AzureNetQ.Tests.Messages
-
-
- {b8def709-5168-48f1-b8d3-ad44e4a4a22b}
- AzureNetQ
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SendReceive/Program.cs b/AzureNetQ.Tests.SendReceive/Program.cs
deleted file mode 100644
index d8a92e6..0000000
--- a/AzureNetQ.Tests.SendReceive/Program.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-namespace AzureNetQ.Tests.SendReceive
-{
- using System;
-
- public class Program
- {
- private const string SendReceiveQueue = "azurenetq.tests.sendreceive";
-
- private const string AuditQueue = "azurenetq.tests.sendreceive.audit";
-
- private IBus bus;
-
- public static void Main(string[] args)
- {
- new Program().Run();
- }
-
- private void Run()
- {
- this.bus = AzureBusFactory.CreateBus();
-
- this.bus.Receive(
- SendReceiveQueue,
- handlers => handlers
- .Add(msg => Console.WriteLine("Handler 1 Received message: {0}", msg.Text))
- .Add(msg => Console.WriteLine("Handler 2 Received message: {0}", msg.Text)));
-
- this.bus.Receive(AuditQueue, msg => Console.WriteLine("Auditor Received message: {0}", msg.Text));
-
- Console.WriteLine("Type a message or 'q' to quit.");
-
- string text = null;
- while ((text = Console.ReadLine()) != "q")
- {
- foreach (var queue in new[] { SendReceiveQueue, AuditQueue })
- {
- this.bus.Send(
- queue,
- new TestSendMessage
- {
- Text = text
- });
-
- this.bus.Send(
- queue,
- new TestSendMessage2
- {
- Text = text
- });
- }
- }
-
- this.bus.Dispose();
- }
- }
-
- [Serializable]
- public class TestSendMessageBase
- {
- public string Text { get; set; }
- }
-
- [Serializable]
- public class TestSendMessage : TestSendMessageBase
- {
- }
-
- [Serializable]
- public class TestSendMessage2 : TestSendMessageBase
- {
- }
-}
diff --git a/AzureNetQ.Tests.SendReceive/Properties/AssemblyInfo.cs b/AzureNetQ.Tests.SendReceive/Properties/AssemblyInfo.cs
deleted file mode 100644
index a8b19cb..0000000
--- a/AzureNetQ.Tests.SendReceive/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AzureNetQ.Tests.SendReceive")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AzureNetQ.Tests.SendReceive")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("5fb49418-75c0-4d24-9689-5ce23c2f7e88")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AzureNetQ.Tests.SendReceive/Settings.StyleCop b/AzureNetQ.Tests.SendReceive/Settings.StyleCop
deleted file mode 100644
index b49c38e..0000000
--- a/AzureNetQ.Tests.SendReceive/Settings.StyleCop
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleRequester/AzureNetQ.Tests.SimpleRequester.csproj b/AzureNetQ.Tests.SimpleRequester/AzureNetQ.Tests.SimpleRequester.csproj
deleted file mode 100644
index d02ea1c..0000000
--- a/AzureNetQ.Tests.SimpleRequester/AzureNetQ.Tests.SimpleRequester.csproj
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}
- Exe
- Properties
- AzureNetQ.Tests.SimpleRequester
- AzureNetQ.Tests.SimpleRequester
- v4.0
-
-
- 512
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
- true
- bin\DebugCloud\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {fd277901-413f-4064-8a38-57a3609872cb}
- AzureNetQ.Tests.Messages
-
-
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}
- AzureNetQ
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleRequester/ILatencyRecorder.cs b/AzureNetQ.Tests.SimpleRequester/ILatencyRecorder.cs
deleted file mode 100644
index 371cdc6..0000000
--- a/AzureNetQ.Tests.SimpleRequester/ILatencyRecorder.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-
-namespace AzureNetQ.Tests.SimpleRequester
-{
- public interface ILatencyRecorder : IDisposable
- {
- void RegisterRequest(long requestId);
- void RegisterResponse(long responseId);
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleRequester/LatencyRecorder.cs b/AzureNetQ.Tests.SimpleRequester/LatencyRecorder.cs
deleted file mode 100644
index d996adb..0000000
--- a/AzureNetQ.Tests.SimpleRequester/LatencyRecorder.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-using System.Linq;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Threading;
-
-namespace AzureNetQ.Tests.SimpleRequester
-{
- public class LatencyRecorder : ILatencyRecorder
- {
- private readonly IDictionary requests =
- new ConcurrentDictionary();
-
- private readonly Timer reportTimer;
-
- private readonly TimeSpan reportInterval;
-
- public LatencyRecorder()
- {
- reportInterval = TimeSpan.FromSeconds(10);
- reportTimer = new Timer(Report, null, reportInterval, reportInterval);
- }
-
- public void Dispose()
- {
- reportTimer.Dispose();
- }
-
- public void RegisterRequest(long requestId)
- {
- requests.Add(requestId, new RequestRecord(requestId));
- }
-
- public void RegisterResponse(long responseId)
- {
- if (!requests.ContainsKey(responseId))
- {
- // see if it turns up
- Thread.Sleep(100);
- if (!requests.ContainsKey(responseId))
- {
- Console.WriteLine("Response contains unknown key: {0}", responseId);
- return;
- }
- }
- requests[responseId].Respond();
- }
-
- public void Report(object status)
- {
- var ticks = DateTime.Now.AddSeconds(-10).Ticks;
- var lateResponses = requests.Where(x => (!x.Value.HasResponded) && (x.Value.Ticks < ticks));
-
- var reponded = requests.Count(x => x.Value.HasResponded);
-
- Console.WriteLine("Total: {0}, reponded: {1} over 10 seconds late: [{2}]",
- requests.Count,
- reponded,
- string.Join(",", lateResponses.Select(x => x.Value.Id.ToString())));
- }
- }
-
- public class RequestRecord
- {
- public RequestRecord(long id)
- {
- Id = id;
- Ticks = DateTime.Now.Ticks;
- }
-
- public void Respond()
- {
- HasResponded = true;
- ResponseTimeTicks = DateTime.Now.Ticks - Ticks;
- }
-
- public long Id { get; private set; }
- public long Ticks { get; private set; }
- public bool HasResponded { get; private set; }
- public long ResponseTimeTicks { get; private set; }
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleRequester/Program.cs b/AzureNetQ.Tests.SimpleRequester/Program.cs
deleted file mode 100644
index 2ef2435..0000000
--- a/AzureNetQ.Tests.SimpleRequester/Program.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-namespace AzureNetQ.Tests.SimpleRequester
-{
- using System;
- using System.Threading;
-
- using AzureNetQ.Loggers;
- using AzureNetQ.Tests.Messages;
-
- public class Program
- {
- private const int PublishIntervalMilliseconds = 20;
-
- private static readonly object RequestLock = new object();
-
- private static readonly IBus Bus =
- AzureBusFactory.CreateBus(
- new AzureNetQSettings
- {
- Logger = () => new NoDebugLogger(),
- ConnectionConfiguration = new ConnectionConfiguration
- {
- PrefetchCount = 200,
- MaxConcurrentCalls = 100,
- BatchingInterval = TimeSpan.FromMilliseconds(50)
- }
- });
-
- private static readonly ILatencyRecorder LatencyRecorder = new LatencyRecorder();
-
- private static long count;
-
- public static void Main(string[] args)
- {
- var timer = new Timer(OnTimer, null, PublishIntervalMilliseconds, PublishIntervalMilliseconds);
-
- Console.Out.WriteLine("Timer running, ctrl-C to end");
-
- Console.CancelKeyPress += (source, cancelKeyPressArgs) =>
- {
- Console.Out.WriteLine("Shutting down");
-
- timer.Dispose();
- Bus.Dispose();
- LatencyRecorder.Dispose();
-
- Console.WriteLine("Shut down complete");
- };
-
- Thread.Sleep(Timeout.Infinite);
- }
-
- public static void OnTimer(object state)
- {
- try
- {
- lock (RequestLock)
- {
- Console.WriteLine("Sending {0}", count);
- Bus.RequestAsync(
- new TestAsyncRequestMessage
- {
- Id = count,
- Text = string.Format("Hello from client number: {0}! ", count)
- }).ContinueWith(
- t =>
- {
- if (t.IsFaulted && t.Exception != null)
- {
- foreach (var exception in t.Exception.InnerExceptions)
- {
- Console.WriteLine("Exception thrown by Response: {0}", exception.Message);
- }
-
- return;
- }
-
- ResponseHandler(t.Result);
- });
-
- LatencyRecorder.RegisterRequest(count);
- count++;
- }
- }
- catch (Exception exception)
- {
- Console.WriteLine("Exception thrown by Publish: {0}", exception.Message);
- }
- }
-
- public static void ResponseHandler(TestAsyncResponseMessage response)
- {
- Console.WriteLine("Response: {0}", response.Text);
- LatencyRecorder.RegisterResponse(response.Id);
- }
- }
-
- public class NoDebugLogger : IAzureNetQLogger
- {
- private readonly ConsoleLogger consoleLogger = new ConsoleLogger();
-
- public void DebugWrite(string format, params object[] args)
- {
- // do nothing
- }
-
- public void InfoWrite(string format, params object[] args)
- {
- // do nothing
- }
-
- public void ErrorWrite(string format, params object[] args)
- {
- this.consoleLogger.ErrorWrite(format, args);
- }
-
- public void ErrorWrite(Exception exception)
- {
- this.consoleLogger.ErrorWrite(exception);
- }
- }
-}
diff --git a/AzureNetQ.Tests.SimpleRequester/Properties/AssemblyInfo.cs b/AzureNetQ.Tests.SimpleRequester/Properties/AssemblyInfo.cs
deleted file mode 100644
index bb85ad8..0000000
--- a/AzureNetQ.Tests.SimpleRequester/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AzureNetQ.Tests.SimpleRequester")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("AzureNetQ.Tests.SimpleRequester")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("9509a2f9-b488-44f9-ac31-4fee3f81ce16")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AzureNetQ.Tests.SimpleRequester/Settings.StyleCop b/AzureNetQ.Tests.SimpleRequester/Settings.StyleCop
deleted file mode 100644
index b49c38e..0000000
--- a/AzureNetQ.Tests.SimpleRequester/Settings.StyleCop
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleRequester/app.config b/AzureNetQ.Tests.SimpleRequester/app.config
deleted file mode 100644
index e857a98..0000000
--- a/AzureNetQ.Tests.SimpleRequester/app.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/AzureNetQ.Tests.SimpleService/AzureNetQ.Tests.SimpleService.csproj b/AzureNetQ.Tests.SimpleService/AzureNetQ.Tests.SimpleService.csproj
deleted file mode 100644
index d674cad..0000000
--- a/AzureNetQ.Tests.SimpleService/AzureNetQ.Tests.SimpleService.csproj
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}
- Exe
- Properties
- AzureNetQ.Tests.SimpleService
- AzureNetQ.Tests.SimpleService
- v4.0
-
-
- 512
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
- true
- bin\DebugCloud\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- MinimumRecommendedRules.ruleset
-
-
-
-
-
-
-
- Properties\Version.cs
-
-
-
-
-
-
- {fd277901-413f-4064-8a38-57a3609872cb}
- AzureNetQ.Tests.Messages
-
-
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}
- AzureNetQ
-
-
-
-
- Designer
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleService/Program.cs b/AzureNetQ.Tests.SimpleService/Program.cs
deleted file mode 100644
index b583755..0000000
--- a/AzureNetQ.Tests.SimpleService/Program.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-namespace AzureNetQ.Tests.SimpleService
-{
- using System;
- using System.Runtime.Serialization;
- using System.Threading;
- using System.Threading.Tasks;
-
- using AzureNetQ.Loggers;
- using AzureNetQ.Tests.Messages;
-
- public class Program
- {
- public static void Main(string[] args)
- {
- var bus =
- AzureBusFactory.CreateBus(
- new AzureNetQSettings
- {
- Logger = () => new NoDebugLogger(),
- ConnectionConfiguration = new ConnectionConfiguration
- {
- PrefetchCount = 200,
- MaxConcurrentCalls = 100,
- BatchingInterval = TimeSpan.FromMilliseconds(50)
- }
- });
-
- bus.RespondAsync(HandleAsyncRequest);
-
- Console.WriteLine("Waiting to service requests");
- Console.WriteLine("Ctrl-C to exit");
-
- Console.CancelKeyPress += (source, cancelKeyPressArgs) =>
- {
- bus.Dispose();
- Console.WriteLine("Shut down complete");
- };
-
- Thread.Sleep(Timeout.Infinite);
- }
-
- public static TestResponseMessage HandleRequest(TestRequestMessage request)
- {
- Console.WriteLine("Handling request: {0}", request.Text);
- if (request.CausesServerToTakeALongTimeToRespond)
- {
- Console.Out.WriteLine("Taking a long time to respond...");
- Thread.Sleep(5000);
- Console.Out.WriteLine("... responding");
- }
-
- if (request.CausesExceptionInServer)
- {
- if (request.ExceptionInServerMessage != null)
- {
- throw new SomeRandomException(request.ExceptionInServerMessage);
- }
-
- throw new SomeRandomException("Something terrible has just happened!");
- }
-
- return new TestResponseMessage { Id = request.Id, Text = request.Text + " all done!" };
- }
-
- private static Task HandleAsyncRequest(TestAsyncRequestMessage request)
- {
- Console.WriteLine("Handling request: {0}", request.Text);
-
- var tcs = new TaskCompletionSource();
- tcs.SetResult(new TestAsyncResponseMessage { Id = request.Id, Text = request.Text + " ... completed." });
-
- return tcs.Task;
- }
-
- private static Task RunDelayed(int millisecondsDelay, Func func)
- {
- if (func == null)
- {
- throw new ArgumentNullException("func");
- }
-
- if (millisecondsDelay < 0)
- {
- throw new ArgumentOutOfRangeException("millisecondsDelay");
- }
-
- var taskCompletionSource = new TaskCompletionSource();
-
- var timer = new Timer(self =>
- {
- ((Timer)self).Dispose();
- try
- {
- var result = func();
- taskCompletionSource.SetResult(result);
- }
- catch (Exception exception)
- {
- taskCompletionSource.SetException(exception);
- }
- });
- timer.Change(millisecondsDelay, millisecondsDelay);
-
- return taskCompletionSource.Task;
- }
- }
-
- [Serializable]
- public class SomeRandomException : Exception
- {
- //// For guidelines regarding the creation of new exception types, see
- //// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp
- //// and
- //// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp
-
- public SomeRandomException()
- {
- }
-
- public SomeRandomException(string message)
- : base(message)
- {
- }
-
- public SomeRandomException(string message, Exception inner)
- : base(message, inner)
- {
- }
-
- protected SomeRandomException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-
- public class NoDebugLogger : IAzureNetQLogger
- {
- private readonly ConsoleLogger logger = new ConsoleLogger();
-
- public void DebugWrite(string format, params object[] args)
- {
- }
-
- public void InfoWrite(string format, params object[] args)
- {
- }
-
- public void ErrorWrite(string format, params object[] args)
- {
- this.logger.ErrorWrite(format, args);
- }
-
- public void ErrorWrite(Exception exception)
- {
- this.logger.ErrorWrite(exception);
- }
- }
-}
diff --git a/AzureNetQ.Tests.SimpleService/Properties/AssemblyInfo.cs b/AzureNetQ.Tests.SimpleService/Properties/AssemblyInfo.cs
deleted file mode 100644
index 84eda72..0000000
--- a/AzureNetQ.Tests.SimpleService/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AzureNetQ.Tests.SimpleService")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("AzureNetQ")]
-[assembly: AssemblyProduct("AzureNetQ.Tests.SimpleService")]
-[assembly: AssemblyCopyright("Copyright © AzureNetQ 2011")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("eb936393-fad8-4727-aafe-532b48b00142")]
-
diff --git a/AzureNetQ.Tests.SimpleService/Settings.StyleCop b/AzureNetQ.Tests.SimpleService/Settings.StyleCop
deleted file mode 100644
index b49c38e..0000000
--- a/AzureNetQ.Tests.SimpleService/Settings.StyleCop
+++ /dev/null
@@ -1,219 +0,0 @@
-
-
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
- False
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests.SimpleService/app.config b/AzureNetQ.Tests.SimpleService/app.config
deleted file mode 100644
index beb93ea..0000000
--- a/AzureNetQ.Tests.SimpleService/app.config
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/AzureNetQ.Tests/AzureNetQ.Tests.csproj b/AzureNetQ.Tests/AzureNetQ.Tests.csproj
deleted file mode 100644
index 9924193..0000000
--- a/AzureNetQ.Tests/AzureNetQ.Tests.csproj
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 9.0.21022
- 2.0
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}
- Library
- Properties
- AzureNetQ.Tests
- AzureNetQ.Tests
- v4.0
- 512
-
-
-
-
-
- 3.5
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
- ..\
- true
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- AllRules.ruleset
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- AllRules.ruleset
-
-
- true
- bin\DebugCloud\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- AllRules.ruleset
-
-
-
-
- ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll
-
-
- ..\packages\NUnit.2.6.2\lib\nunit.framework.dll
-
-
- False
- ..\packages\RabbitMQ.Client.3.2.1\lib\net30\RabbitMQ.Client.dll
-
-
- ..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll
-
-
-
-
-
-
- Properties\Version.cs
-
-
-
-
-
- {9888950b-ef30-4763-9076-38b071cdb535}
- AzureNetQ.Management.Client
-
-
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}
- AzureNetQ
-
-
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- true
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.Tests/Properties/AssemblyInfo.cs b/AzureNetQ.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index d7c6f50..0000000
--- a/AzureNetQ.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("AzureNetQ.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("AzureNetQ")]
-[assembly: AssemblyProduct("AzureNetQ.Tests")]
-[assembly: AssemblyCopyright("Copyright © AzureNetQ 2011")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1dff2e31-d6a3-4744-b608-0607a3b08605")]
-
diff --git a/AzureNetQ.Tests/packages.config b/AzureNetQ.Tests/packages.config
deleted file mode 100644
index 443ff86..0000000
--- a/AzureNetQ.Tests/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.nuspec b/AzureNetQ.nuspec
deleted file mode 100644
index 2e99124..0000000
--- a/AzureNetQ.nuspec
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- 0.2.0.1
- Roysvork
- Roysvork
- AzureNetQ
- AzureNetQ
- false
- AzureNetQ is a client API for Microsoft Azure Service Bus & Service Bus for Windows on .NET
- Pete Smith 2014
- http://roysvork.github.io/AzureNetQ
- https://github.com/roysvork/AzureNetQ/blob/master/licence.txt
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/AzureNetQ.sln b/AzureNetQ.sln
deleted file mode 100644
index 1ce3d45..0000000
--- a/AzureNetQ.sln
+++ /dev/null
@@ -1,142 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.30501.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ", "AzureNetQ\AzureNetQ.csproj", "{B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ.Tests", "AzureNetQ.Tests\AzureNetQ.Tests.csproj", "{640DEC15-3A17-4E85-B38A-CFB379426DC2}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ.Tests.SimpleService", "AzureNetQ.Tests.SimpleService\AzureNetQ.Tests.SimpleService.csproj", "{D5166633-83A2-48FA-B534-C2EC9D9DE9C3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ.Tests.SimpleRequester", "AzureNetQ.Tests.SimpleRequester\AzureNetQ.Tests.SimpleRequester.csproj", "{5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ.Tests.Messages", "AzureNetQ.Tests.Messages\AzureNetQ.Tests.Messages.csproj", "{FD277901-413F-4064-8A38-57A3609872CB}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ.Tests.SendReceive", "AzureNetQ.Tests.SendReceive\AzureNetQ.Tests.SendReceive.csproj", "{4818FCD2-1E75-4CEA-8B00-E5259E217BB8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureNetQ.Tests.PublishSubscribe", "AzureNetQ.Tests.PublishSubscribe\AzureNetQ.Tests.PublishSubscribe.csproj", "{6D68DFA2-6271-4847-96FA-631AE49D2CCA}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|x86 = Debug|x86
- DebugCloud|Any CPU = DebugCloud|Any CPU
- DebugCloud|Mixed Platforms = DebugCloud|Mixed Platforms
- DebugCloud|x86 = DebugCloud|x86
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.DebugCloud|Any CPU.ActiveCfg = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.DebugCloud|Any CPU.Build.0 = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.DebugCloud|x86.ActiveCfg = Debug|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Release|Any CPU.Build.0 = Release|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {B8DEF709-5168-48F1-B8D3-AD44E4A4A22B}.Release|x86.ActiveCfg = Release|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Debug|x86.ActiveCfg = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.DebugCloud|Any CPU.ActiveCfg = DebugCloud|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.DebugCloud|Any CPU.Build.0 = DebugCloud|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.DebugCloud|x86.ActiveCfg = DebugCloud|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Release|Any CPU.Build.0 = Release|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {640DEC15-3A17-4E85-B38A-CFB379426DC2}.Release|x86.ActiveCfg = Release|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.DebugCloud|Any CPU.ActiveCfg = DebugCloud|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.DebugCloud|Any CPU.Build.0 = DebugCloud|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.DebugCloud|x86.ActiveCfg = DebugCloud|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Release|Any CPU.Build.0 = Release|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {D5166633-83A2-48FA-B534-C2EC9D9DE9C3}.Release|x86.ActiveCfg = Release|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Debug|x86.ActiveCfg = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.DebugCloud|Any CPU.ActiveCfg = DebugCloud|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.DebugCloud|Any CPU.Build.0 = DebugCloud|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.DebugCloud|x86.ActiveCfg = DebugCloud|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Release|Any CPU.Build.0 = Release|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {5EDAA7BF-CD00-440C-9697-D24F7B37CFFA}.Release|x86.ActiveCfg = Release|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Debug|x86.ActiveCfg = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.DebugCloud|Any CPU.ActiveCfg = DebugCloud|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.DebugCloud|Any CPU.Build.0 = DebugCloud|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.DebugCloud|x86.ActiveCfg = DebugCloud|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Release|Any CPU.Build.0 = Release|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {FD277901-413F-4064-8A38-57A3609872CB}.Release|x86.ActiveCfg = Release|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Debug|x86.ActiveCfg = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.DebugCloud|Any CPU.ActiveCfg = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.DebugCloud|Any CPU.Build.0 = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.DebugCloud|x86.ActiveCfg = Debug|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Release|Any CPU.Build.0 = Release|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {4818FCD2-1E75-4CEA-8B00-E5259E217BB8}.Release|x86.ActiveCfg = Release|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.DebugCloud|Any CPU.ActiveCfg = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.DebugCloud|Any CPU.Build.0 = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.DebugCloud|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.DebugCloud|Mixed Platforms.Build.0 = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.DebugCloud|x86.ActiveCfg = Debug|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Release|Any CPU.Build.0 = Release|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {6D68DFA2-6271-4847-96FA-631AE49D2CCA}.Release|x86.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/AzureNetQ/AutoSubscribe/AutoSubscriber.cs b/AzureNetQ/AutoSubscribe/AutoSubscriber.cs
deleted file mode 100644
index 629ade8..0000000
--- a/AzureNetQ/AutoSubscribe/AutoSubscriber.cs
+++ /dev/null
@@ -1,322 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Threading.Tasks;
-
- using AzureNetQ.FluentConfiguration;
-
- ///
- /// Lets you scan assemblies for implementations of so that
- /// these will get registrered as subscribers in the bus.
- ///
- public class AutoSubscriber
- {
- protected const string ConsumeMethodName = "Consume";
- protected const string DispatchMethodName = "Dispatch";
- protected const string DispatchAsyncMethodName = "DispatchAsync";
- protected const string HandleMethodName = "Handle";
- protected const string HandleAsyncMethodName = "HandleAsync";
-
- protected readonly IBus Bus;
-
- public AutoSubscriber(IBus bus)
- {
- Preconditions.CheckNotNull(bus, "bus");
-
- this.Bus = bus;
- this.AutoSubscriberMessageDispatcher = new DefaultAutoSubscriberMessageDispatcher();
- }
-
- ///
- /// Responsible for consuming a message with the relevant message consumer.
- ///
- public IAutoSubscriberMessageDispatcher AutoSubscriberMessageDispatcher { get; set; }
-
- public virtual void Subscribe(
- Assembly assembly)
- {
- this.Subscribe(assembly, x => { });
- }
-
- public virtual void Subscribe(
- Assembly assembly, Action configuration)
- {
- this.Subscribe(new List { assembly }, configuration);
- }
-
- public virtual void Subscribe(
- List assemblies)
- {
- this.Subscribe(assemblies, x => { });
- }
-
- ///
- /// Registers all consumers in passed assembly. The actual Subscriber instances is
- /// created using .
- ///
- /// The assembleis to scan for consumers.
- ///
- public virtual void Subscribe(List assemblies, Action configuration)
- {
- Preconditions.CheckAny(assemblies, "assemblies", "No assemblies specified.");
-
- var autoSubscriptionConfiguration = new AutoSubscriptionConfiguration();
- configuration(autoSubscriptionConfiguration);
-
- var genericBusSubscribeMethod = this.GetSubscribeMethodOfBus("Subscribe", typeof(Action<>));
- var subscriptionInfos = this.GetConsumerInfos(assemblies.SelectMany(a => a.GetTypes()), typeof(IConsume<>));
-
- this.InvokeMethods(
- autoSubscriptionConfiguration,
- subscriptionInfos,
- DispatchMethodName,
- genericBusSubscribeMethod,
- messageType => typeof(Action<>).MakeGenericType(messageType));
-
- var genericBusRespondMethod = this.GetRespondMethodOfBus("Respond", typeof(Func<,>));
- var responderInfos = this.GetResponderInfos(assemblies.SelectMany(a => a.GetTypes()), typeof(IRespond<,>));
-
- this.InvokeMethods(
- autoSubscriptionConfiguration,
- responderInfos,
- HandleMethodName,
- genericBusRespondMethod,
- (messageType, responseType) => typeof(Func<,>).MakeGenericType(messageType, responseType));
- }
-
- public virtual void SubscribeAsync(
- Assembly assembly)
- {
- this.SubscribeAsync(assembly, x => { });
- }
-
- public virtual void SubscribeAsync(
- Assembly assembly, Action configuration)
- {
- this.SubscribeAsync(new List { assembly }, configuration);
- }
-
- public virtual void SubscribeAsync(
- List assemblies)
- {
- this.SubscribeAsync(assemblies, x => { });
- }
-
- ///
- /// Registers all async consumers in passed assembly. The actual Subscriber instances is
- /// created using .
- ///
- /// The assembleis to scan for consumers.
- ///
- public virtual void SubscribeAsync(List assemblies, Action configuration)
- {
- Preconditions.CheckAny(assemblies, "assemblies", "No assemblies specified.");
-
- var autoSubscriptionConfiguration = new AutoSubscriptionConfiguration();
- configuration(autoSubscriptionConfiguration);
-
- var genericBusSubscribeMethod = this.GetSubscribeMethodOfBus("SubscribeAsync", typeof(Func<,>));
- var consumerInfos = this.GetConsumerInfos(assemblies.SelectMany(a => a.GetTypes()), typeof(IConsumeAsync<>));
- Func subscriberTypeFromMessageTypeDelegate =
- messageType => typeof(Func<,>).MakeGenericType(messageType, typeof(Task));
-
- this.InvokeMethods(
- autoSubscriptionConfiguration,
- consumerInfos,
- DispatchAsyncMethodName,
- genericBusSubscribeMethod,
- subscriberTypeFromMessageTypeDelegate);
-
- var genericBusRespondMethod = this.GetRespondMethodOfBus("RespondAsync", typeof(Func<,>));
- var responderInfos = this.GetResponderInfos(assemblies.SelectMany(a => a.GetTypes()), typeof(IRespondAsync<,>));
- Func subscriberTypeFromMessageAndResponseTypeDelegate =
- (messageType, responseType) => typeof(Func<,>).MakeGenericType(messageType, typeof(Task<>).MakeGenericType(responseType));
-
- this.InvokeMethods(
- autoSubscriptionConfiguration,
- responderInfos,
- HandleAsyncMethodName,
- genericBusRespondMethod,
- subscriberTypeFromMessageAndResponseTypeDelegate);
- }
-
- protected void InvokeMethods(
- AutoSubscriptionConfiguration autoSubscriptionConfiguration,
- IEnumerable> subscriptionInfos,
- string dispatchName,
- MethodInfo genericBusSubscribeMethod,
- Func subscriberTypeFromMessageTypeDelegate)
- {
- foreach (var kv in subscriptionInfos)
- {
- foreach (var subscriptionInfo in kv.Value)
- {
- var dispatchMethod =
- this.AutoSubscriberMessageDispatcher.GetType()
- .GetMethod(dispatchName, BindingFlags.Instance | BindingFlags.Public)
- .MakeGenericMethod(subscriptionInfo.MessageType, subscriptionInfo.ConcreteType);
-
- var configurationActions = new List>();
- var subscriptionAttribute = this.GetSubscriptionAttribute(subscriptionInfo);
- if (subscriptionAttribute != null)
- {
- configurationActions.Add(c => c.WithSubscription(subscriptionAttribute.Name));
- }
-
- var readAndDeleteAttribute = this.GetReadAndDeleteAttribute(subscriptionInfo);
- if (readAndDeleteAttribute != null)
- {
- configurationActions.Add(c => c.InReadAndDeleteMode());
- }
-
- var configuration =
- new Action(c => configurationActions.ForEach(o => o(c)));
-
- var dispatchDelegate =
- Delegate.CreateDelegate(
- subscriberTypeFromMessageTypeDelegate(subscriptionInfo.MessageType),
- this.AutoSubscriberMessageDispatcher,
- dispatchMethod);
-
- var busSubscribeMethod = genericBusSubscribeMethod.MakeGenericMethod(subscriptionInfo.MessageType);
-
- busSubscribeMethod.Invoke(this.Bus, new object[] { dispatchDelegate, configuration });
- }
- }
- }
-
- protected virtual SubscriptionAttribute GetSubscriptionAttribute(AutoSubscriberConsumerInfo subscriptionInfo)
- {
- var consumeMethod = this.ConsumeMethod(subscriptionInfo);
- return consumeMethod.GetCustomAttributes(typeof(SubscriptionAttribute), true).SingleOrDefault() as SubscriptionAttribute;
- }
-
- protected virtual ReceiveAndDeleteAttribute GetReadAndDeleteAttribute(AutoSubscriberConsumerInfo subscriptionInfo)
- {
- var consumeMethod = this.ConsumeMethod(subscriptionInfo);
- return consumeMethod.GetCustomAttributes(typeof(ReceiveAndDeleteAttribute), true).SingleOrDefault() as ReceiveAndDeleteAttribute;
- }
-
- protected void InvokeMethods(
- AutoSubscriptionConfiguration autoSubscriptionConfiguration,
- IEnumerable> subscriptionInfos,
- string handlerName,
- MethodInfo genericBusRespondMethod,
- Func subscriberTypeFromMessageTypeDelegate)
- {
- foreach (var kv in subscriptionInfos)
- {
- foreach (var subscriptionInfo in kv.Value)
- {
- var configuration = new Action(c => { });
- if (autoSubscriptionConfiguration.AffinityResolver != null)
- {
- configuration = c => c.WithAffinityResolver(autoSubscriptionConfiguration.AffinityResolver);
- }
-
- var handleMethod =
- this.AutoSubscriberMessageDispatcher.GetType()
- .GetMethod(handlerName, BindingFlags.Instance | BindingFlags.Public)
- .MakeGenericMethod(
- subscriptionInfo.MessageType,
- subscriptionInfo.ResponseType,
- subscriptionInfo.ConcreteType);
-
- var handleDelegate =
- Delegate.CreateDelegate(
- subscriberTypeFromMessageTypeDelegate(
- subscriptionInfo.MessageType,
- subscriptionInfo.ResponseType),
- this.AutoSubscriberMessageDispatcher,
- handleMethod);
-
- var busRespondMethod = genericBusRespondMethod.MakeGenericMethod(
- subscriptionInfo.MessageType,
- subscriptionInfo.ResponseType);
-
- busRespondMethod.Invoke(this.Bus, new object[] { handleDelegate, configuration });
- }
- }
- }
-
- protected virtual bool IsValidMarkerType(Type markerType)
- {
- return markerType.IsInterface && markerType.GetMethods().Any(m => m.Name == ConsumeMethodName);
- }
-
- protected virtual MethodInfo GetSubscribeMethodOfBus(string method, Type paramType)
- {
- return
- this.Bus.GetType()
- .GetMethods()
- .Where(m => m.Name == method)
- .Select(m => new { Method = m, Params = m.GetParameters() })
- .Single(
- m =>
- m.Params.Length == 2 && m.Params[0].ParameterType.GetGenericTypeDefinition() == paramType
- && m.Params[1].ParameterType == typeof(Action))
- .Method;
- }
-
- protected virtual MethodInfo GetRespondMethodOfBus(string method, Type paramType)
- {
- return
- this.Bus.GetType()
- .GetMethods()
- .Where(m => m.Name == method)
- .Select(m => new { Method = m, Params = m.GetParameters() })
- .Single(
- m =>
- m.Params.Length == 2 && m.Params[0].ParameterType.GetGenericTypeDefinition() == paramType
- && m.Params[1].ParameterType == typeof(Action))
- .Method;
- }
-
- protected virtual IEnumerable> GetConsumerInfos(IEnumerable types, Type interfaceType)
- {
- foreach (var concreteType in types.Where(t => t.IsClass))
- {
- var subscriptionInfos = concreteType.GetInterfaces()
- .Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == interfaceType)
- .Select(i => new AutoSubscriberConsumerInfo(concreteType, i, i.GetGenericArguments()[0]))
- .ToArray();
-
- if (subscriptionInfos.Any())
- {
- yield return new KeyValuePair(concreteType, subscriptionInfos);
- }
- }
- }
-
- protected virtual IEnumerable> GetResponderInfos(IEnumerable types, Type interfaceType)
- {
- foreach (var concreteType in types.Where(t => t.IsClass))
- {
- var subscriptionInfos = concreteType.GetInterfaces()
- .Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == interfaceType)
- .Select(i => new AutoSubscriberResponderInfo(concreteType, i, i.GetGenericArguments()[0], i.GetGenericArguments()[1]))
- .ToArray();
-
- if (subscriptionInfos.Any())
- {
- yield return new KeyValuePair(concreteType, subscriptionInfos);
- }
- }
- }
-
- private MethodInfo ConsumeMethod(AutoSubscriberConsumerInfo consumerInfo)
- {
- return consumerInfo.ConcreteType.GetMethod(ConsumeMethodName, new[] { consumerInfo.MessageType }) ??
- this.GetExplicitlyDeclaredInterfaceMethod(consumerInfo.MessageType);
- }
-
- private MethodInfo GetExplicitlyDeclaredInterfaceMethod(Type messageType)
- {
- var interfaceType = typeof(IConsume<>).MakeGenericType(messageType);
- return interfaceType.GetMethod(ConsumeMethodName);
- }
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/AutoSubscriberConsumerInfo.cs b/AzureNetQ/AutoSubscribe/AutoSubscriberConsumerInfo.cs
deleted file mode 100644
index e5332ca..0000000
--- a/AzureNetQ/AutoSubscribe/AutoSubscriberConsumerInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
-
- [Serializable]
- public class AutoSubscriberConsumerInfo
- {
- public readonly Type ConcreteType;
- public readonly Type InterfaceType;
- public readonly Type MessageType;
-
- public AutoSubscriberConsumerInfo(Type concreteType, Type interfaceType, Type messageType)
- {
- Preconditions.CheckNotNull(concreteType, "concreteType");
- Preconditions.CheckNotNull(interfaceType, "interfaceType");
- Preconditions.CheckNotNull(messageType, "messageType");
-
- this.ConcreteType = concreteType;
- this.InterfaceType = interfaceType;
- this.MessageType = messageType;
- }
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/AutoSubscriberResponderInfo.cs b/AzureNetQ/AutoSubscribe/AutoSubscriberResponderInfo.cs
deleted file mode 100644
index c0f7f34..0000000
--- a/AzureNetQ/AutoSubscribe/AutoSubscriberResponderInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
-
- [Serializable]
- public class AutoSubscriberResponderInfo
- {
- public readonly Type ConcreteType;
-
- public readonly Type InterfaceType;
-
- public readonly Type MessageType;
-
- public readonly Type ResponseType;
-
- public AutoSubscriberResponderInfo(Type concreteType, Type interfaceType, Type messageType, Type responseType)
- {
- Preconditions.CheckNotNull(concreteType, "concreteType");
- Preconditions.CheckNotNull(interfaceType, "interfaceType");
- Preconditions.CheckNotNull(messageType, "messageType");
- Preconditions.CheckNotNull(responseType, "responseType");
-
- this.ConcreteType = concreteType;
- this.InterfaceType = interfaceType;
- this.MessageType = messageType;
- this.ResponseType = responseType;
- }
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/AutoSubscriptionConfiguration.cs b/AzureNetQ/AutoSubscribe/AutoSubscriptionConfiguration.cs
deleted file mode 100644
index 8026ddf..0000000
--- a/AzureNetQ/AutoSubscribe/AutoSubscriptionConfiguration.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
-
- public interface IAutoSubscriptionConfiguration
- {
- Func AffinityResolver { get; set; }
-
- IAutoSubscriptionConfiguration WithAffinityResolver(Func affinityResolver);
- }
-
- public class AutoSubscriptionConfiguration : IAutoSubscriptionConfiguration
- {
- public Func AffinityResolver { get; set; }
-
- public IAutoSubscriptionConfiguration WithAffinityResolver(Func affinityResolver)
- {
- this.AffinityResolver = affinityResolver;
- return this;
- }
- }
-}
diff --git a/AzureNetQ/AutoSubscribe/DefaultAutoSubscriberMessageDispatcher.cs b/AzureNetQ/AutoSubscribe/DefaultAutoSubscriberMessageDispatcher.cs
deleted file mode 100644
index fe947b5..0000000
--- a/AzureNetQ/AutoSubscribe/DefaultAutoSubscriberMessageDispatcher.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
- using System.Threading.Tasks;
-
- public class DefaultAutoSubscriberMessageDispatcher : IAutoSubscriberMessageDispatcher
- {
- public void Dispatch(TMessage message)
- where TMessage : class
- where TConsumer : IConsume
- {
- var consumer = (IConsume)Activator.CreateInstance(typeof(TConsumer));
-
- consumer.Consume(message);
- }
-
- public Task DispatchAsync(TMessage message)
- where TMessage : class
- where TConsumer : IConsumeAsync
- {
- var consumer = (IConsumeAsync)Activator.CreateInstance(typeof(TConsumer));
-
- return consumer.Consume(message);
- }
-
- public TResponse Handle(TMessage message)
- where TMessage : class
- where TResponder : IRespond
- {
- var responder = (IRespond)Activator.CreateInstance(typeof(TResponder));
- return responder.Respond(message);
- }
-
- public Task HandleAsync(TMessage message)
- where TMessage : class
- where TResponder : IRespondAsync
- {
- var responder = (IRespondAsync)Activator.CreateInstance(typeof(TResponder));
- return responder.Respond(message);
- }
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/IAutoSubscriberMessageDispatcher.cs b/AzureNetQ/AutoSubscribe/IAutoSubscriberMessageDispatcher.cs
deleted file mode 100644
index 7d31d0d..0000000
--- a/AzureNetQ/AutoSubscribe/IAutoSubscriberMessageDispatcher.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System.Threading.Tasks;
-
- public interface IAutoSubscriberMessageDispatcher
- {
- void Dispatch(TMessage message)
- where TMessage : class
- where TConsumer : IConsume;
-
- Task DispatchAsync(TMessage message)
- where TMessage : class
- where TConsumer : IConsumeAsync;
-
- TResponse Handle(TMessage message)
- where TMessage : class
- where TResponder : IRespond;
-
- Task HandleAsync(TMessage message)
- where TMessage : class
- where TResponder : IRespondAsync;
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/IConsume.cs b/AzureNetQ/AutoSubscribe/IConsume.cs
deleted file mode 100644
index b888702..0000000
--- a/AzureNetQ/AutoSubscribe/IConsume.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- public interface IConsume where T : class
- {
- void Consume(T message);
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/IConsumeAsync.cs b/AzureNetQ/AutoSubscribe/IConsumeAsync.cs
deleted file mode 100644
index 125547a..0000000
--- a/AzureNetQ/AutoSubscribe/IConsumeAsync.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System.Threading.Tasks;
-
- public interface IConsumeAsync where T : class
- {
- Task Consume(T message);
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/IRespond.cs b/AzureNetQ/AutoSubscribe/IRespond.cs
deleted file mode 100644
index 716c4d2..0000000
--- a/AzureNetQ/AutoSubscribe/IRespond.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- public interface IRespond where T : class
- {
- TResponse Respond(T message);
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/IRespondAsync.cs b/AzureNetQ/AutoSubscribe/IRespondAsync.cs
deleted file mode 100644
index d4ac202..0000000
--- a/AzureNetQ/AutoSubscribe/IRespondAsync.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System.Threading.Tasks;
-
- public interface IRespondAsync where T : class
- {
- Task Respond(T message);
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AutoSubscribe/ReadAndDeleteAttribute.cs b/AzureNetQ/AutoSubscribe/ReadAndDeleteAttribute.cs
deleted file mode 100644
index f22e20c..0000000
--- a/AzureNetQ/AutoSubscribe/ReadAndDeleteAttribute.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
-
- [Serializable]
- [AttributeUsage(AttributeTargets.Method)]
- public class ReceiveAndDeleteAttribute : Attribute
- {
- }
-}
diff --git a/AzureNetQ/AutoSubscribe/SubscriptionAttribute.cs b/AzureNetQ/AutoSubscribe/SubscriptionAttribute.cs
deleted file mode 100644
index b94f882..0000000
--- a/AzureNetQ/AutoSubscribe/SubscriptionAttribute.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace AzureNetQ.AutoSubscribe
-{
- using System;
-
- [Serializable]
- [AttributeUsage(AttributeTargets.Method)]
- public class SubscriptionAttribute : Attribute
- {
- public string Name { get; set; }
- }
-}
diff --git a/AzureNetQ/AzureAdvancedBus.cs b/AzureNetQ/AzureAdvancedBus.cs
deleted file mode 100644
index ec69809..0000000
--- a/AzureNetQ/AzureAdvancedBus.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-namespace AzureNetQ
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Security;
- using System.Security.Cryptography.X509Certificates;
-
- using Microsoft.ServiceBus;
- using Microsoft.ServiceBus.Messaging;
-
- public interface IAzureAdvancedBus
- {
- QueueClient QueueDeclare(string name, bool autoDelete = false);
-
- void QueueDelete(string name);
-
- TopicClient TopicFind(string name);
-
- TopicClient TopicDeclare(string name, bool requiresDuplicateDetection);
-
- void TopicDelete(string topic);
-
- SubscriptionClient SubscriptionDeclare(
- string name,
- List topic,
- string subscription,
- ReceiveMode receiveMode,
- bool requiresDuplicateDetection,
- int maxDeliveryCount);
- }
-
- public class AzureAdvancedBus : IAzureAdvancedBus
- {
- private readonly IAzureNetQLogger logger;
-
- private readonly IConnectionConfiguration configuration;
-
- private readonly ConcurrentDictionary queues;
-
- private readonly ConcurrentDictionary topics;
-
- private readonly ConcurrentDictionary subscriptions;
-
- private readonly NamespaceManager namespaceManager;
-
- private readonly MessagingFactory messagingFactory;
-
- public AzureAdvancedBus(IAzureNetQLogger logger, IConnectionConfiguration configuration)
- {
- this.namespaceManager = NamespaceManager.CreateFromConnectionString(configuration.ConnectionString);
-
- var pairs = configuration.ConnectionString.Split(';').Select(o => o.Split('=')).Where(o => o.Length > 1);
-
- var dictionary = pairs.ToDictionary(key => key[0], value => value[1]);
- var address = this.namespaceManager.Address;
-
- int port;
- if (dictionary.ContainsKey("Endpoint") && dictionary.ContainsKey("RuntimePort")
- && int.TryParse(dictionary["RuntimePort"], out port))
- {
- var template = new Uri(string.Format("{0}", dictionary["Endpoint"]));
- address = new UriBuilder(template.Scheme, template.Host, port, template.PathAndQuery).Uri;
- }
-
- var mfs = new MessagingFactorySettings
- {
- TokenProvider = this.namespaceManager.Settings.TokenProvider,
- NetMessagingTransportSettings =
- {
- BatchFlushInterval =
- configuration
- .BatchingInterval
- }
- };
-
- this.messagingFactory = MessagingFactory.Create(address, mfs);
-
- this.queues = new ConcurrentDictionary();
- this.topics = new ConcurrentDictionary();
- this.subscriptions = new ConcurrentDictionary();
-
- this.logger = logger;
- this.configuration = configuration;
- }
-
- public virtual QueueClient QueueDeclare(string name, bool autoDelete = false)
- {
- Preconditions.CheckNotNull(name, "name");
-
- return this.queues.GetOrAdd(
- name,
- s =>
- {
-#if DEBUG
- SslValidator.OverrideValidation();
-#endif
- if (!namespaceManager.QueueExists(s))
- {
- var description = new QueueDescription(s);
- if (autoDelete)
- {
- description.AutoDeleteOnIdle = TimeSpan.FromMinutes(5);
- }
-
- description.DefaultMessageTimeToLive = TimeSpan.FromDays(5);
- description.EnableDeadLetteringOnMessageExpiration = true;
- description.LockDuration = TimeSpan.FromSeconds(15);
-
- logger.DebugWrite("Declared Queue: '{0}'", name);
- namespaceManager.CreateQueue(description);
- }
-
- var client = messagingFactory.CreateQueueClient(s);
- client.PrefetchCount = configuration.PrefetchCount;
-
- return client;
- });
- }
-
- public SubscriptionClient SubscriptionDeclare(
- string name,
- List topicNames,
- string subscription,
- ReceiveMode receiveMode,
- bool requiresDuplicateDetection,
- int maxDeliveryCount)
- {
- var topicClient = this.TopicDeclare(name, requiresDuplicateDetection);
-
- return this.subscriptions.GetOrAdd(
- BuildSubscriptionKey(name, subscription, topicNames),
- s =>
- {
-#if DEBUG
- SslValidator.OverrideValidation();
-#endif
- var parts = new List { subscription };
- parts.AddRange(topicNames);
-
- var subscriptionId =
- string.Join("-", parts.Where(o => !string.IsNullOrEmpty(o)))
- .Replace("#", "_")
- .Replace("*", "_");
-
- if (!namespaceManager.SubscriptionExists(topicClient.Path, subscriptionId))
- {
- var description = new SubscriptionDescription(topicClient.Path, subscriptionId)
- {
- MaxDeliveryCount = maxDeliveryCount,
- DefaultMessageTimeToLive = TimeSpan.FromDays(5),
- EnableDeadLetteringOnMessageExpiration = true,
- LockDuration = TimeSpan.FromMinutes(1)
- };
-
- if (topicNames.Any())
- {
- var expression = string.Join(
- " OR ",
- topicNames.Select(
- o => string.Format("user.topic LIKE '{0}'", TransformWildcards(o))));
-
- var filter = new SqlFilter(expression);
- namespaceManager.CreateSubscription(description, filter);
-
- logger.DebugWrite(
- "Declared Subscription: '{0}' on Topic {1} with filter {2}",
- subscription,
- topicClient.Path,
- filter);
- }
- else
- {
- namespaceManager.CreateSubscription(description);
- logger.DebugWrite(
- "Declared Subscription: '{0}' on Topic {1}",
- subscription,
- topicClient.Path);
- }
- }
-
- return messagingFactory.CreateSubscriptionClient(topicClient.Path, subscriptionId, receiveMode);
- });
- }
-
- public TopicClient TopicFind(string name)
- {
- var topicClient = this.topics.GetOrAdd(
- name,
- n =>
- {
-#if DEBUG
- SslValidator.OverrideValidation();
-#endif
- return this.namespaceManager.TopicExists(n) ? this.messagingFactory.CreateTopicClient(n) : null;
- });
-
- return topicClient;
- }
-
- public TopicClient TopicDeclare(string name, bool requiresDuplicateDetection)
- {
- var topicClient = this.topics.GetOrAdd(
- name,
- n =>
- {
-#if DEBUG
- SslValidator.OverrideValidation();
-#endif
- if (!this.namespaceManager.TopicExists(n))
- {
- var description = new TopicDescription(n) { RequiresDuplicateDetection = requiresDuplicateDetection };
-
- this.logger.DebugWrite("Declared Topic: '{0}'", n);
- this.namespaceManager.CreateTopic(description);
- }
-
- var client = this.messagingFactory.CreateTopicClient(n);
- return client;
- });
- return topicClient;
- }
-
- public void QueueDelete(string name)
- {
- QueueClient toRemove;
- if (this.queues.TryRemove(name, out toRemove))
- {
-#if DEBUG
- SslValidator.OverrideValidation();
-#endif
- if (this.namespaceManager.QueueExists(name))
- {
- this.namespaceManager.DeleteQueue(name);
- }
- }
- }
-
- public void TopicDelete(string topic)
- {
- TopicClient toRemove;
- if (this.topics.TryRemove(topic, out toRemove))
- {
-#if DEBUG
- SslValidator.OverrideValidation();
-#endif
- if (this.namespaceManager.TopicExists(topic))
- {
- this.namespaceManager.DeleteTopic(topic);
- }
- }
- }
-
- private static string TransformWildcards(string o)
- {
- return o.Replace('#', '%').Replace('*', '%');
- }
-
- private static string BuildSubscriptionKey(string name, string subscription, IEnumerable topics)
- {
- return string.Format("{0}{1}{2}", name, subscription, string.Join(string.Empty, topics));
- }
-
- public static class SslValidator
- {
- public static void OverrideValidation()
- {
- ServicePointManager.ServerCertificateValidationCallback =
- OnValidateCertificate;
- ServicePointManager.Expect100Continue = true;
- }
-
- private static bool OnValidateCertificate(
- object sender,
- X509Certificate certificate,
- X509Chain chain,
- SslPolicyErrors sslPolicyErrors)
- {
- return true;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/AzureNetQ/AzureBus.cs b/AzureNetQ/AzureBus.cs
deleted file mode 100644
index bc3a7b0..0000000
--- a/AzureNetQ/AzureBus.cs
+++ /dev/null
@@ -1,487 +0,0 @@
-namespace AzureNetQ
-{
- using System;
- using System.Linq;
- using System.Threading;
- using System.Threading.Tasks;
-
- using AzureNetQ.Consumer;
- using AzureNetQ.FluentConfiguration;
- using AzureNetQ.Producer;
-
- using Microsoft.ServiceBus.Messaging;
-
- public class AzureBus : IBus
- {
- private readonly IAzureNetQLogger logger;
-
- private readonly IConventions conventions;
-
- private readonly IRpc rpc;
-
- private readonly ISendReceive sendReceive;
-
- private readonly IAzureAdvancedBus advancedBus;
-
- private readonly IConnectionConfiguration connectionConfiguration;
-
- private readonly ISerializer serializer;
-
- private readonly IExceptionHandler exceptionHandler;
-
- public AzureBus(
- IAzureNetQLogger logger,
- IConventions conventions,
- IRpc rpc,
- ISendReceive sendReceive,
- IAzureAdvancedBus advancedBus,
- IConnectionConfiguration connectionConfiguration,
- ISerializer serializer)
- {
- Preconditions.CheckNotNull(logger, "logger");
- Preconditions.CheckNotNull(conventions, "conventions");
- Preconditions.CheckNotNull(rpc, "rpc");
- Preconditions.CheckNotNull(sendReceive, "sendReceive");
- Preconditions.CheckNotNull(advancedBus, "advancedBus");
- Preconditions.CheckNotNull(connectionConfiguration, "connectionConfiguration");
- Preconditions.CheckNotNull(serializer, "serializer");
-
- this.logger = logger;
- this.conventions = conventions;
- this.rpc = rpc;
- this.sendReceive = sendReceive;
- this.advancedBus = advancedBus;
- this.connectionConfiguration = connectionConfiguration;
- this.serializer = serializer;
- this.exceptionHandler = new ExceptionHandler(logger);
- }
-
- public IAzureNetQLogger Logger
- {
- get { return this.logger; }
- }
-
- public IConventions Conventions
- {
- get { return this.conventions; }
- }
-
- public void Publish(T message) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
-
- this.PublishAsync(message).Wait();
- }
-
- public void Publish(T message, string topic) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
-
- this.PublishAsync(message, topic).Wait();
- }
-
- public void Publish(T message, Action configure) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(configure, "configure");
-
- this.PublishAsync(message, configure).Wait();
- }
-
- public void Publish(T message, string topic, Action configure) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
- Preconditions.CheckNotNull(configure, "configure");
-
- this.PublishAsync(message, topic, configure).Wait();
- }
-
- public void Publish(Type type, object message)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
-
- this.PublishAsync(type, message, x => { }).Wait();
- }
-
- public void Publish(Type type, object message, string topic)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
-
- this.PublishAsync(type, message, topic, x => { }).Wait();
- }
-
- public void Publish(Type type, object message, Action configure)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(configure, "configure");
-
- this.PublishAsync(type, message, configure).Wait();
- }
-
- public void Publish(Type type, object message, string topic, Action configure)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
- Preconditions.CheckNotNull(configure, "configure");
-
- this.PublishAsync(type, message, topic, configure).Wait();
- }
-
- public Task PublishAsync(T message) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
-
- return this.PublishAsync(message, x => { });
- }
-
- public Task PublishAsync(T message, string topic) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
-
- return this.PublishAsync(message, topic, x => { });
- }
-
- public Task PublishAsync(T message, Action configure) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(configure, "configure");
-
- return this.PublishAsync(typeof(T), message, configure);
- }
-
- public Task PublishAsync(T message, string topic, Action configure) where T : class
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
- Preconditions.CheckNotNull(configure, "configure");
-
- return this.PublishAsync(typeof(T), message, topic, configure);
- }
-
- public Task PublishAsync(Type type, object message)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
-
- return this.PublishAsync(type, message, x => { });
- }
-
- public Task PublishAsync(Type type, object message, string topic)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(topic, "topic");
-
- return this.PublishAsync(type, message, topic, x => { });
- }
-
- public Task PublishAsync(Type type, object message, Action configure)
- {
- Preconditions.CheckNotNull(type, "type");
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(configure, "configure");
-
- return this.PublishAsync(type, message, this.conventions.TopicNamingConvention(type), configure);
- }
-
- public Task PublishAsync(Type type, object message, string topicName, Action configure)
- {
- Preconditions.CheckNotNull(message, "message");
- Preconditions.CheckNotNull(configure, "configure");
-
- var queueName = this.conventions.QueueNamingConvention(type);
- var queue = this.advancedBus.TopicFind(queueName);
-
- if (queue != null)
- {
- var configuration = new PublishConfiguration();
- configure(configuration);
-
- var content = this.serializer.MessageToString(message);
- var azureNetQMessage = new BrokeredMessage(content);
- azureNetQMessage.Properties.Add("topic", topicName);
-
- if (!string.IsNullOrEmpty(configuration.MessageId))
- {
- azureNetQMessage.MessageId = configuration.MessageId;
- }
-
- this.InfoWrite(queueName, azureNetQMessage.MessageId, string.Format("Publishing message: {0}", content));
- return queue.SendAsync(azureNetQMessage);
- }
-
- var tcs = new TaskCompletionSource();
- tcs.SetResult(false);
- return tcs.Task;
- }
-
- public virtual void Subscribe(Action onMessage) where T : class
- {
- this.Subscribe(onMessage, x => { });
- }
-
- public virtual void Subscribe(Action onMessage, Action configure)
- where T : class
- {
- Preconditions.CheckNotNull(onMessage, "onMessage");
- Preconditions.CheckNotNull(configure, "configure");
-
- this.SubscribeAsync(
- msg =>
- {
- var tcs = new TaskCompletionSource