Skip to content

Commit

Permalink
AMQNET-589: Failover implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Havret committed Jul 16, 2019
1 parent b90ff7c commit 896e51c
Show file tree
Hide file tree
Showing 222 changed files with 22,839 additions and 11,890 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,4 @@ ModelManifest.xml

# FAKE - F# Make
.fake/
.idea/
6 changes: 3 additions & 3 deletions apache-nms-amqp.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache-NMS-AMQP", "src\NMS.AMQP\Apache-NMS-AMQP.csproj", "{0D8CF699-9702-4EC6-8719-C2968D32F09A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "src\HelloWorld\HelloWorld.csproj", "{A56349BE-ED66-4E18-B5FE-E3EA069D2ADD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache-NMS-AMQP-Test", "test\Apache-NMS-AMQP-Test.csproj", "{DF402917-D85D-421C-A7E2-DC3DF371B9CB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache-NMS-AMQP-Test", "test\Apache-NMS-AMQP-Test\Apache-NMS-AMQP-Test.csproj", "{DF402917-D85D-421C-A7E2-DC3DF371B9CB}"
ProjectSection(ProjectDependencies) = postProject
{0D8CF699-9702-4EC6-8719-C2968D32F09A} = {0D8CF699-9702-4EC6-8719-C2968D32F09A}
EndProjectSection
Expand Down
35 changes: 19 additions & 16 deletions src/HelloWorld/HelloWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System;
using System.Collections.Specialized;
using Apache.NMS;
using Apache.NMS.AMQP;
using CommandLine;

namespace HelloWorld
Expand Down Expand Up @@ -65,20 +66,6 @@ private static void RunWithOptions (CommandLineOpts opts)
Uri providerUri = new Uri(ip);
Console.WriteLine("scheme: {0}", providerUri.Scheme);

StringDictionary properties = new StringDictionary();
if (opts.username != null)
{
properties["NMS.username"] = opts.username;
}
if (opts.password != null)
{
properties["NMS.password"] = opts.password;
}
if (opts.clientId != null)
{
properties["NMS.clientId"] = opts.clientId;
}
properties["NMS.sendtimeout"] = opts.connTimeout+"";
IConnection conn = null;
if (opts.topic == null && opts.queue == null)
{
Expand All @@ -87,8 +74,24 @@ private static void RunWithOptions (CommandLineOpts opts)
}
try
{
Apache.NMS.AMQP.NMSConnectionFactory providerFactory = new Apache.NMS.AMQP.NMSConnectionFactory(providerUri, properties);
IConnectionFactory factory = providerFactory.ConnectionFactory;
NmsConnectionFactory factory = new NmsConnectionFactory(ip);
if (opts.username != null)
{
factory.UserName = opts.username;
}
if (opts.password != null)
{
factory.Password = opts.password;
}
if (opts.clientId != null)
{
factory.ClientId = opts.clientId;
}

if (opts.connTimeout != default)
{
factory.SendTimeout = opts.connTimeout;
}

Console.WriteLine("Creating Connection...");
conn = factory.CreateConnection();
Expand Down
1 change: 1 addition & 0 deletions src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ under the License.
<OutputType>Exe</OutputType>
<RootNamespace>HelloWorld</RootNamespace>
<AssemblyName>HelloWorld</AssemblyName>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/NMS.AMQP/Apache-NMS-AMQP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ with the License. You may obtain a copy of the License at
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>Apache.NMS.AMQP</RootNamespace>
<AssemblyName>Apache.NMS.AMQP</AssemblyName>
<LangVersion>7.3</LangVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -63,5 +64,6 @@ with the License. You may obtain a copy of the License at
<!-- AMQPNetLite.Core is .NET Standard 1.3 package -->
<PackageReference Include="AMQPNetLite.Core" Version="2.1.7" />
<PackageReference Include="Apache.NMS" Version="1.8.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="4.9.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit 896e51c

Please sign in to comment.