diff --git a/LICENSE b/LICENSE index 3492de1..6c35a62 100644 Binary files a/LICENSE and b/LICENSE differ diff --git a/README.md b/README.md index 0487c5e..69e6f6c 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,17 @@ NATS Streaming provides the following high-level feature set: ## Notes - Please raise questions/issues via the [Issue Tracker](https://github.com/nats-io/csharp-nats-streaming/issues) or via natsio.slack.com (contact larry@apcera.com or brian@apcera.com for access) -## Known Issues -- Time- and sequence-based subscriptions are exact. Requesting a time or seqno before the earliest stored message for a subject will result in an error when creating a subscription. - ## Installation -The NATS streaming .NET client can be installed manually by downloading the source and building. [NuGet](www.nuget.com) and an environment to build [Visual Studio](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx) project files is required. +For convenience, the NATS streaming client can found on NuGet as [STAN.Client](https://www.nuget.org/packages/STAN.Client/). + +Alternatively, you can build the C# NATS streaming client yourself. To build, you'll need an environment to build [Visual Studio](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx) and/or .NET core project files. -From the directory the repository has been cloned into, either invoke `build.bat` from the command line, or open the `STAN.sln` project file in Visual Studio and build from there. +### .NET core +From the directory the repository has been cloned into, either invoke `buildcore.bat` from the command line, or open the `STANcore.sln` project file in Visual Studio and build from there. -NuGet packages will be coming soon. +### .NET 4.5 +From the directory the repository has been cloned into, either invoke `build45.bat` from the command line, or open the `STANnet45.sln` project file in Visual Studio and build from there. ### API Documentation @@ -154,7 +155,6 @@ var s = c.Subscribe("foo", opts, (obj, args) => NATS Streaming subscriptions **do not** support wildcards. - ## Advanced Usage ### Asynchronous Publishing @@ -173,7 +173,9 @@ var guid = await c.PublishAsync("foo", null); // alternatively, one can work in some application code. var t = c.PublishAsync("foo", null); -// application code + +// your application can do work here + guid = await t; ``` @@ -278,7 +280,7 @@ var s = c.Subscribe("foo", sOpts, (obj, args) => ``` ## TODO -- [ ] Core 1.0 support +- [X] Core 1.0 support - [ ] Rx API - [ ] Robust Benchmark Testing - [X] CI (Appveyor) diff --git a/STAN.CLIENT/AsyncSubscription.cs b/STAN.CLIENT/AsyncSubscription.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/BlockingChannel.cs b/STAN.CLIENT/BlockingChannel.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/Consts.cs b/STAN.CLIENT/Consts.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/IStanConnection.cs b/STAN.CLIENT/IStanConnection.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/IStanSubscription.cs b/STAN.CLIENT/IStanSubscription.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/Options.cs b/STAN.CLIENT/Options.cs old mode 100755 new mode 100644 index 27e462b..3398ea4 --- a/STAN.CLIENT/Options.cs +++ b/STAN.CLIENT/Options.cs @@ -22,21 +22,21 @@ public sealed class StanOptions internal StanOptions() { } - private string deepCopy(string value) + internal static string DeepCopy(string value) { if (value == null) return null; - return string.Copy(value); + return new string(value.ToCharArray()); } internal StanOptions(StanOptions options) { ackTimeout = options.ackTimeout; - NatsURL = deepCopy(options.NatsURL); + NatsURL = DeepCopy(options.NatsURL); ConnectTimeout = options.ConnectTimeout; PubAckWait = options.PubAckWait; - DiscoverPrefix = deepCopy(options.DiscoverPrefix); + DiscoverPrefix = DeepCopy(options.DiscoverPrefix); MaxPubAcksInFlight = options.MaxPubAcksInFlight; NatsConn = options.natsConn; } diff --git a/STAN.CLIENT/Properties/AssemblyInfo.cs b/STAN.CLIENT/Properties/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/Protocol.cs b/STAN.CLIENT/Protocol.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/ProtocolSerializer.cs b/STAN.CLIENT/ProtocolSerializer.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/STAN.CLIENT.xproj b/STAN.CLIENT/STAN.CLIENT.xproj new file mode 100644 index 0000000..630ee1c --- /dev/null +++ b/STAN.CLIENT/STAN.CLIENT.xproj @@ -0,0 +1,19 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 23ee6838-d8a6-4787-bafb-2148ef6f5b79 + STAN.CLIENT + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/STAN.CLIENT/STANExceptions.cs b/STAN.CLIENT/STANExceptions.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/StanAckHandlerArgs.cs b/STAN.CLIENT/StanAckHandlerArgs.cs old mode 100755 new mode 100644 diff --git a/STAN.CLIENT/StanConnection.cs b/STAN.CLIENT/StanConnection.cs old mode 100755 new mode 100644 index 651530c..2e8f20f --- a/STAN.CLIENT/StanConnection.cs +++ b/STAN.CLIENT/StanConnection.cs @@ -57,8 +57,7 @@ internal PublishAck(Connection conn, string guid, EventHandler + + + + + + + + diff --git a/STAN.Client.UnitTests/Properties/AssemblyInfo.cs b/STAN.Client.UnitTests/Properties/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/STAN.Client.UnitTests/Properties/Settings.Designer.cs b/STAN.Client.UnitTests/Properties/Settings.Designer.cs index aeaa070..43cf02d 100644 --- a/STAN.Client.UnitTests/Properties/Settings.Designer.cs +++ b/STAN.Client.UnitTests/Properties/Settings.Designer.cs @@ -9,8 +9,8 @@ //------------------------------------------------------------------------------ namespace STAN.Client.UnitTests.Properties { - - + +#if NET45 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { @@ -23,4 +23,5 @@ internal sealed partial class Settings : global::System.Configuration.Applicatio } } } +#endif } diff --git a/STAN.Client.UnitTests/STAN.Client.UnitTests.xproj b/STAN.Client.UnitTests/STAN.Client.UnitTests.xproj new file mode 100644 index 0000000..eb4b524 --- /dev/null +++ b/STAN.Client.UnitTests/STAN.Client.UnitTests.xproj @@ -0,0 +1,21 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 9a3ea015-7552-417d-a3d9-698d664e954c + STAN.Client.UnitTests + .\obj + .\bin\ + + + 2.0 + + + + + + \ No newline at end of file diff --git a/STAN.Client.UnitTests/UnitTestUtilities.cs b/STAN.Client.UnitTests/UnitTestUtilities.cs index b492609..32d8ebc 100755 --- a/STAN.Client.UnitTests/UnitTestUtilities.cs +++ b/STAN.Client.UnitTests/UnitTestUtilities.cs @@ -1,186 +1,201 @@ -/******************************************************************************* - * Copyright (c) 2015-2016 Apcera Inc. All rights reserved. This program and the accompanying - * materials are made available under the terms of the MIT License (MIT) which accompanies this - * distribution, and is available at http://opensource.org/licenses/MIT - *******************************************************************************/ -using System; -using System.Threading; -using System.Diagnostics; -using System.Reflection; -using NATS.Client; - -namespace STAN.Client.UnitTests -{ - class NatsStreamingServer : IDisposable - { - bool debug = false; - Process p; - - private bool isNatsServerRunning() - { - try - { - IConnection c = new NATS.Client.ConnectionFactory().CreateConnection(); - c.Close(); - return true; - } - catch (Exception) - { - return false; - } - } - - public void init(bool shouldDebug) - { - UnitTestUtilities.CleanupExistingServers(); - - debug = shouldDebug; - ProcessStartInfo psInfo = createProcessStartInfo(); - p = Process.Start(psInfo); - for (int i = 0; i < 20; i++) - { - Thread.Sleep(500); - if (isNatsServerRunning()) - break; - } - // Allow the Nats streaming server to setup. - Thread.Sleep(250); - } - - public NatsStreamingServer() - { - init(false); - } - - public NatsStreamingServer(bool shouldDebug) - { - init(shouldDebug); - } - - private void addArgument(ProcessStartInfo psInfo, string arg) - { - if (psInfo.Arguments == null) - { - psInfo.Arguments = arg; - } - else - { - string args = psInfo.Arguments; - args += arg; - psInfo.Arguments = args; - } - } - - public NatsStreamingServer(int port) - { - ProcessStartInfo psInfo = createProcessStartInfo(); - - addArgument(psInfo, "-p " + port); - - this.p = Process.Start(psInfo); - } - - public NatsStreamingServer(string args) - { - ProcessStartInfo psInfo = this.createProcessStartInfo(); - addArgument(psInfo, args); - p = Process.Start(psInfo); - } - - private ProcessStartInfo createProcessStartInfo() - { - string nss = "nats-streaming-server.exe"; - ProcessStartInfo psInfo = new ProcessStartInfo(nss); - - if (debug) - { - psInfo.Arguments = " -SDV -DV"; - } - else - { - psInfo.WindowStyle = ProcessWindowStyle.Hidden; - } - - psInfo.WorkingDirectory = UnitTestUtilities.GetConfigDir(); - - return psInfo; - } - - public void Shutdown() - { - if (p == null) - return; - - try - { - p.Kill(); - } - catch (Exception) { } - - p = null; - } - - void IDisposable.Dispose() - { - Shutdown(); - } - } - - class UnitTestUtilities - { - object mu = new object(); - static NatsStreamingServer defaultServer = null; - - static internal string GetConfigDir() - { - string baseDir = Assembly.GetExecutingAssembly().CodeBase; - return baseDir + "\\NATSUnitTests\\config"; - } - - public void StartDefaultServer() - { - lock (mu) - { - if (defaultServer == null) - { - defaultServer = new NatsStreamingServer(); - } - } - } - - public void StopDefaultServer() - { - lock (mu) - { - try - { - defaultServer.Shutdown(); - } - catch (Exception) { } - - defaultServer = null; - } - } - - public void bounceDefaultServer(int delayMillis) - { - StopDefaultServer(); - Thread.Sleep(delayMillis); - StartDefaultServer(); - } - - internal static void CleanupExistingServers() - { - try - { - Process[] procs = Process.GetProcessesByName("nats-streaming-server"); - - foreach (Process proc in procs) - { - proc.Kill(); - } - } - catch (Exception) { } // ignore - } - } -} +/******************************************************************************* + * Copyright (c) 2015-2016 Apcera Inc. All rights reserved. This program and the accompanying + * materials are made available under the terms of the MIT License (MIT) which accompanies this + * distribution, and is available at http://opensource.org/licenses/MIT + *******************************************************************************/ +using System; +using System.Threading; +using System.Diagnostics; +#if NET45 +using System.Reflection; +#endif +using NATS.Client; + +using System.IO; + +namespace STAN.Client.UnitTests +{ + class NatsStreamingServer : IDisposable + { + bool debug = false; + Process p; + + private bool isNatsServerRunning() + { + try + { + IConnection c = new NATS.Client.ConnectionFactory().CreateConnection(); + c.Close(); + return true; + } + catch (Exception) + { + return false; + } + } + + public void init(bool shouldDebug) + { + UnitTestUtilities.CleanupExistingServers(); + + debug = shouldDebug; + ProcessStartInfo psInfo = createProcessStartInfo(); + p = Process.Start(psInfo); + for (int i = 0; i < 20; i++) + { + Thread.Sleep(500); + if (isNatsServerRunning()) + break; + } + // Allow the Nats streaming server to setup. + Thread.Sleep(250); + } + + public NatsStreamingServer() + { + init(false); + } + + public NatsStreamingServer(bool shouldDebug) + { + init(shouldDebug); + } + + private void addArgument(ProcessStartInfo psInfo, string arg) + { + if (psInfo.Arguments == null) + { + psInfo.Arguments = arg; + } + else + { + string args = psInfo.Arguments; + args += arg; + psInfo.Arguments = args; + } + } + + public NatsStreamingServer(int port) + { + ProcessStartInfo psInfo = createProcessStartInfo(); + + addArgument(psInfo, "-p " + port); + + this.p = Process.Start(psInfo); + } + + public NatsStreamingServer(string args) + { + ProcessStartInfo psInfo = this.createProcessStartInfo(); + addArgument(psInfo, args); + p = Process.Start(psInfo); + } + + private ProcessStartInfo createProcessStartInfo() + { + string nss = "nats-streaming-server.exe"; + ProcessStartInfo psInfo = new ProcessStartInfo(nss); + + if (debug) + { + psInfo.Arguments = " -SDV -DV"; + } + else + { +#if NET45 + psInfo.WindowStyle = ProcessWindowStyle.Hidden; +#else + psInfo.CreateNoWindow = false; + psInfo.RedirectStandardError = true; +#endif + } + + psInfo.WorkingDirectory = UnitTestUtilities.GetConfigDir(); + + return psInfo; + } + + public void Shutdown() + { + if (p == null) + return; + + try + { + p.Kill(); + } + catch (Exception) { } + + p = null; + } + + void IDisposable.Dispose() + { + Shutdown(); + } + } + + class UnitTestUtilities + { + object mu = new object(); + static NatsStreamingServer defaultServer = null; + + static internal string GetConfigDir() + { +#if NET45 + string baseDir = Assembly.GetExecutingAssembly().CodeBase; + return baseDir + "\\NATSUnitTests\\config"; +#else + return AppContext.BaseDirectory + + string.Format("{0}..{0}..{0}..{0}", + Path.DirectorySeparatorChar); +#endif + } + + public void StartDefaultServer() + { + lock (mu) + { + if (defaultServer == null) + { + defaultServer = new NatsStreamingServer(); + } + } + } + + public void StopDefaultServer() + { + lock (mu) + { + try + { + defaultServer.Shutdown(); + } + catch (Exception) { } + + defaultServer = null; + } + } + + public void bounceDefaultServer(int delayMillis) + { + StopDefaultServer(); + Thread.Sleep(delayMillis); + StartDefaultServer(); + } + + internal static void CleanupExistingServers() + { + try + { + Process[] procs = Process.GetProcessesByName("nats-streaming-server"); + + foreach (Process proc in procs) + { + proc.Kill(); + } + } + catch (Exception) { } // ignore + } + } +} diff --git a/STAN.Client.UnitTests/project.json b/STAN.Client.UnitTests/project.json new file mode 100755 index 0000000..60866d4 --- /dev/null +++ b/STAN.Client.UnitTests/project.json @@ -0,0 +1,26 @@ +{ + "version": "1.0.0-*", + + "testRunner": "xunit", + + "dependencies": { + "NATS.Client": "*", + "NETStandard.Library": "1.6.0", + "System.Diagnostics.Process": "4.1.0", + "xunit": "2.2.0-rc3-build3528", + "dotnet-test-xunit" : "2.2.0-preview2-build1029", + "xunit.runner.visualstudio": "2.2.0-beta2-build1149", + "STAN.Client" : "*" + }, + + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "version": "1.0.0", + "type": "platform" + } + } + } + } +} diff --git a/STANCore.sln b/STANCore.sln new file mode 100755 index 0000000..b8a3260 --- /dev/null +++ b/STANCore.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "STAN.CLIENT", "STAN.CLIENT\STAN.CLIENT.xproj", "{23EE6838-D8A6-4787-BAFB-2148EF6F5B79}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "STAN.Client.UnitTests", "STAN.Client.UnitTests\STAN.Client.UnitTests.xproj", "{9A3EA015-7552-417D-A3D9-698D664E954C}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "stan-pub", "examples\stan-pub\stan-pub.xproj", "{6AC8D7CA-C931-4DAC-B8B8-EF5011ACA356}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "stan-sub", "examples\stan-sub\stan-sub.xproj", "{EEA80816-1BEB-47FD-97F2-1E8EB683C80D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {23EE6838-D8A6-4787-BAFB-2148EF6F5B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23EE6838-D8A6-4787-BAFB-2148EF6F5B79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23EE6838-D8A6-4787-BAFB-2148EF6F5B79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23EE6838-D8A6-4787-BAFB-2148EF6F5B79}.Release|Any CPU.Build.0 = Release|Any CPU + {9A3EA015-7552-417D-A3D9-698D664E954C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A3EA015-7552-417D-A3D9-698D664E954C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A3EA015-7552-417D-A3D9-698D664E954C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A3EA015-7552-417D-A3D9-698D664E954C}.Release|Any CPU.Build.0 = Release|Any CPU + {6AC8D7CA-C931-4DAC-B8B8-EF5011ACA356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AC8D7CA-C931-4DAC-B8B8-EF5011ACA356}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AC8D7CA-C931-4DAC-B8B8-EF5011ACA356}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AC8D7CA-C931-4DAC-B8B8-EF5011ACA356}.Release|Any CPU.Build.0 = Release|Any CPU + {EEA80816-1BEB-47FD-97F2-1E8EB683C80D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEA80816-1BEB-47FD-97F2-1E8EB683C80D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEA80816-1BEB-47FD-97F2-1E8EB683C80D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEA80816-1BEB-47FD-97F2-1E8EB683C80D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/STAN.sln b/STANnet45.sln similarity index 83% rename from STAN.sln rename to STANnet45.sln index eea1204..1c98545 100755 --- a/STAN.sln +++ b/STANnet45.sln @@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STAN.Client", "STAN.CLIENT\STAN.Client.csproj", "{A92ECD64-3BA4-4AB2-BD58-5E4D97AF972C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STAN.Client", "net45\STAN.CLIENT\STAN.Client.csproj", "{A92ECD64-3BA4-4AB2-BD58-5E4D97AF972C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STAN.Client.UnitTests", "STAN.Client.UnitTests\STAN.Client.UnitTests.csproj", "{72E03EF2-C7AF-49EA-B6E0-1FB8E3204053}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STAN.Client.UnitTests", "net45\STAN.Client.UnitTests\STAN.Client.UnitTests.csproj", "{72E03EF2-C7AF-49EA-B6E0-1FB8E3204053}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stan-sub", "examples\stan-sub\stan-sub.csproj", "{F74C9C78-1CE9-440B-A276-8B4FE46BF3E5}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stan-sub", "net45\examples\stan-sub\stan-sub.csproj", "{F74C9C78-1CE9-440B-A276-8B4FE46BF3E5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stan-pub", "examples\stan-pub\stan-pub.csproj", "{7E321D88-4117-456D-B9CF-03F2042D608D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "stan-pub", "net45\examples\stan-pub\stan-pub.csproj", "{7E321D88-4117-456D-B9CF-03F2042D608D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/appveyor.yml b/appveyor.yml index a5a146c..abef0f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,12 +4,24 @@ install: - 7z e nats-streaming-server-v0.3.8-windows-amd64.zip nats-streaming-server-v0.3.8.exe -r -oc:\projects\nss\build - cmd: ren C:\projects\nss\build\nats-streaming-server-v0.3.8.exe nats-streaming-server.exe - cmd: set PATH=%PATH%;C:\projects\nss\build -before_build: - - nuget restore -build: - project: STAN.sln + +# to add several configurations to build matrix: +configuration: + - Release + +environment: + matrix: + - arch_name: core + - arch_name: net45 + +# to run your custom scripts instead of automatic MSBuild +build_script: + - cmd: appveyor\bld%arch_name%.bat + +test_script: + - cmd: appveyor\test%arch_name%.bat + notifications: - provider: GitHubPullRequest auth_token: - secure: iVXvp6gJv5IQjqJRZJCXVw== - template: "{{#passed}}:white_check_mark:{{/passed}}{{#failed}}:x:{{/failed}} [Build {{&projectName}} {{buildVersion}} {{status}}]({{buildUrl}}) (commit {{commitUrl}} by @{{&commitAuthorUsername}})" + secure: XI9j+cGG2z/YLFNk+KCnLQ== \ No newline at end of file diff --git a/appveyor/bldcore.bat b/appveyor/bldcore.bat new file mode 100755 index 0000000..9c9b482 --- /dev/null +++ b/appveyor/bldcore.bat @@ -0,0 +1,9 @@ +dotnet restore STAN.Client +dotnet build -c Release STAN.Client +dotnet pack -c Release STAN.Client + +dotnet restore examples STAN.Client.UnitTests +dotnet build -c Release examples/stan-sub +dotnet build -c Release examples/stan-pub + +REM msbuild STANcore.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" diff --git a/appveyor/bldnet45.bat b/appveyor/bldnet45.bat new file mode 100755 index 0000000..fae2601 --- /dev/null +++ b/appveyor/bldnet45.bat @@ -0,0 +1,2 @@ +nuget restore STANnet45.sln +msbuild STANnet45.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" \ No newline at end of file diff --git a/appveyor/testcore.bat b/appveyor/testcore.bat new file mode 100755 index 0000000..1b3de0b --- /dev/null +++ b/appveyor/testcore.bat @@ -0,0 +1 @@ +dotnet test STAN.Client.UnitTests \ No newline at end of file diff --git a/appveyor/testnet45.bat b/appveyor/testnet45.bat new file mode 100755 index 0000000..bc044b8 --- /dev/null +++ b/appveyor/testnet45.bat @@ -0,0 +1 @@ +%xunit20%\xunit.console.x86 "net45\STAN.Client.UnitTests\bin\Release\STAN.Client.UnitTests.dll" -appveyor diff --git a/build.bat b/build45.bat similarity index 62% rename from build.bat rename to build45.bat index c201733..68fdd1e 100755 --- a/build.bat +++ b/build45.bat @@ -5,5 +5,5 @@ REM Requirements: Nuget and Visual Studio must be installed and setup REM in the environment. REM e.g. for Visual Studio community 2015, run "%VS140COMNTOOLS%\vsvars32.bat" -nuget restore STAN.sln -msbuild STAN.sln /nologo /verbosity:minimal /t:Rebuild /p:Configuration=Release \ No newline at end of file +nuget restore STANnet45.sln +msbuild STANnet45.sln /nologo /verbosity:minimal /t:Rebuild /p:Configuration=Release \ No newline at end of file diff --git a/buildcore.bat b/buildcore.bat new file mode 100755 index 0000000..2b39a39 --- /dev/null +++ b/buildcore.bat @@ -0,0 +1,7 @@ +dotnet restore STAN.Client +dotnet build -c Release STAN.Client +dotnet pack -c Release STAN.Client + +dotnet restore examples +dotnet build -c Release examples/stan-sub +dotnet build -c Release examples/stan-pub diff --git a/doc/DoxyFile.STAN.Client b/doc/DoxyFile.STAN.Client old mode 100755 new mode 100644 diff --git a/doc/build_doc.bat b/doc/build_doc.bat old mode 100755 new mode 100644 diff --git a/doc/customdoxygen.css b/doc/customdoxygen.css old mode 100755 new mode 100644 diff --git a/doc/footer.html b/doc/footer.html old mode 100755 new mode 100644 diff --git a/doc/header.html b/doc/header.html old mode 100755 new mode 100644 diff --git a/examples/stan-pub/Nuget.Config b/examples/stan-pub/Nuget.Config new file mode 100755 index 0000000..77c39ac --- /dev/null +++ b/examples/stan-pub/Nuget.Config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/examples/stan-pub/project.json b/examples/stan-pub/project.json new file mode 100755 index 0000000..b5fea9f --- /dev/null +++ b/examples/stan-pub/project.json @@ -0,0 +1,23 @@ +{ + "title": "STAN Publisher", + "copyright": "Copyright © Apcera 2017", + "description": "NATS Streaming Publisher Example", + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + }, + "STAN.Client": "*" + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/examples/stan-pub/stan-pub.cs b/examples/stan-pub/stan-pub.cs old mode 100755 new mode 100644 diff --git a/examples/stan-pub/stan-pub.xproj b/examples/stan-pub/stan-pub.xproj new file mode 100755 index 0000000..ec6c4ef --- /dev/null +++ b/examples/stan-pub/stan-pub.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 6ac8d7ca-c931-4dac-b8b8-ef5011aca356 + stan-pub + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/examples/stan-sub/Nuget.Config b/examples/stan-sub/Nuget.Config new file mode 100755 index 0000000..77c39ac --- /dev/null +++ b/examples/stan-sub/Nuget.Config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/examples/stan-sub/Properties/AssemblyInfo.cs b/examples/stan-sub/Properties/AssemblyInfo.cs old mode 100755 new mode 100644 diff --git a/examples/stan-sub/project.json b/examples/stan-sub/project.json new file mode 100755 index 0000000..6de976a --- /dev/null +++ b/examples/stan-sub/project.json @@ -0,0 +1,23 @@ +{ + "title": "STAN Subscriber", + "copyright": "Copyright © Apcera 2017", + "description": "NATS Streaming Subscriber Example", + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + }, + "STAN.Client": "*" + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/examples/stan-sub/stan-sub.cs b/examples/stan-sub/stan-sub.cs old mode 100755 new mode 100644 diff --git a/examples/stan-sub/stan-sub.xproj b/examples/stan-sub/stan-sub.xproj new file mode 100755 index 0000000..f3cc31f --- /dev/null +++ b/examples/stan-sub/stan-sub.xproj @@ -0,0 +1,19 @@ + + + + 14.0.25420 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + eea80816-1beb-47fd-97f2-1e8eb683c80d + stan-sub + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/global.json b/global.json new file mode 100755 index 0000000..c442579 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "projects": [ "STAN.Client", "STAN.Client.UnitTests" ], + "sdk": { + "version": "1.0.0-preview2-003121" + } +} diff --git a/install_nss.sh b/install_nss.sh old mode 100755 new mode 100644 diff --git a/STAN.Client.UnitTests/STAN.Client.UnitTests.csproj b/net45/STAN.Client.UnitTests/STAN.Client.UnitTests.csproj old mode 100755 new mode 100644 similarity index 64% rename from STAN.Client.UnitTests/STAN.Client.UnitTests.csproj rename to net45/STAN.Client.UnitTests/STAN.Client.UnitTests.csproj index cf03675..41557a1 --- a/STAN.Client.UnitTests/STAN.Client.UnitTests.csproj +++ b/net45/STAN.Client.UnitTests/STAN.Client.UnitTests.csproj @@ -1,6 +1,6 @@  - + Debug @@ -22,7 +22,7 @@ full false bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;NET45 prompt 4 @@ -31,7 +31,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;NET45 prompt 4 @@ -39,8 +39,8 @@ - - ..\packages\NATS.Client.0.6.1\lib\net45\NATS.Client.DLL + + ..\..\packages\NATS.Client.0.7.0\lib\net45\NATS.Client.DLL True @@ -51,44 +51,44 @@ - - ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll + + ..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True - - ..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll + + ..\..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll True - - ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll + + ..\..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll True - - ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll + + ..\..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll True - - + + True True Settings.settings - - + + Designer - - Designer - - + SettingsSingleFileGenerator Settings.Designer.cs + + Designer + @@ -104,13 +104,13 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - \ No newline at end of file diff --git a/STAN.Client.UnitTests/app.config b/net45/STAN.Client.UnitTests/app.config old mode 100755 new mode 100644 similarity index 96% rename from STAN.Client.UnitTests/app.config rename to net45/STAN.Client.UnitTests/app.config index 3c88dd4..8227adb --- a/STAN.Client.UnitTests/app.config +++ b/net45/STAN.Client.UnitTests/app.config @@ -1,6 +1,6 @@ - - - - - - + + + + + + diff --git a/STAN.Client.UnitTests/packages.config b/net45/STAN.Client.UnitTests/packages.config old mode 100755 new mode 100644 similarity index 59% rename from STAN.Client.UnitTests/packages.config rename to net45/STAN.Client.UnitTests/packages.config index e18eb9a..d5b1e15 --- a/STAN.Client.UnitTests/packages.config +++ b/net45/STAN.Client.UnitTests/packages.config @@ -1,11 +1,12 @@ - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/STAN.CLIENT/STAN.Client.csproj b/net45/STAN.Client/STAN.Client.csproj old mode 100755 new mode 100644 similarity index 62% rename from STAN.CLIENT/STAN.Client.csproj rename to net45/STAN.Client/STAN.Client.csproj index 07c3fc2..6cfaa46 --- a/STAN.CLIENT/STAN.Client.csproj +++ b/net45/STAN.Client/STAN.Client.csproj @@ -18,7 +18,7 @@ full false bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;NET45 prompt 4 false @@ -27,7 +27,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;NET45 prompt 4 false @@ -35,11 +35,11 @@ - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll + ..\..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll True - - ..\packages\NATS.Client.0.6.1\lib\net45\NATS.Client.DLL + + ..\..\packages\NATS.Client.0.7.0\lib\net45\NATS.Client.DLL True @@ -52,26 +52,28 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + + Designer + + + + + + Debug + AnyCPU + {7E321D88-4117-456D-B9CF-03F2042D608D} + Exe + Properties + STAN.Examples + stan-pub + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {a92ecd64-3ba4-4ab2-bd58-5e4d97af972c} + STAN.Client + + + + \ No newline at end of file diff --git a/examples/stan-sub/App.config b/net45/examples/stan-sub/App.config old mode 100755 new mode 100644 similarity index 97% rename from examples/stan-sub/App.config rename to net45/examples/stan-sub/App.config index d740e88..88fa402 --- a/examples/stan-sub/App.config +++ b/net45/examples/stan-sub/App.config @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/examples/stan-sub/stan-sub.csproj b/net45/examples/stan-sub/stan-sub.csproj old mode 100755 new mode 100644 similarity index 94% rename from examples/stan-sub/stan-sub.csproj rename to net45/examples/stan-sub/stan-sub.csproj index 245d1af..df2815d --- a/examples/stan-sub/stan-sub.csproj +++ b/net45/examples/stan-sub/stan-sub.csproj @@ -1,66 +1,66 @@ - - - - - Debug - AnyCPU - {F74C9C78-1CE9-440B-A276-8B4FE46BF3E5} - Exe - Properties - STAN.Examples - stan-sub - v4.5.2 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - {a92ecd64-3ba4-4ab2-bd58-5e4d97af972c} - STAN.Client - - - - + + + + + Debug + AnyCPU + {F74C9C78-1CE9-440B-A276-8B4FE46BF3E5} + Exe + Properties + STAN.Examples + stan-sub + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + {a92ecd64-3ba4-4ab2-bd58-5e4d97af972c} + STAN.Client + + + + \ No newline at end of file diff --git a/nuget/STAN.Client.nuspec b/nuget/STAN.Client.nuspec old mode 100755 new mode 100644 index 8af2f66..2d44be9 --- a/nuget/STAN.Client.nuspec +++ b/nuget/STAN.Client.nuspec @@ -1,27 +1,30 @@ - - - - STAN.Client - 0.1.4.0 - NATS Streaming .NET Client - Apcera,Inc. - Apcera,Inc. - https://raw.githubusercontent.com/nats-io/csharp-nats-streaming/master/LICENSE - https://github.com/nats-io/csharp-nats-streaming - false - NATS acts as a central nervous system for distributed systems at scale, such as mobile devices, IoT networks, and cloud native infrastructure. This is the .NET Streaming client API. - NATS Streaming .NET Client - Bug fixes. - Copyright 2016 Apcera, Inc. - - Apcera NATS Messaging Cloud Publish Subscribe PubSub Streaming Persistence - - - - - - - - - - + + + + STAN.Client + 0.1.4.0 + NATS Streaming .NET Client + Apcera,Inc. + Apcera,Inc. + https://raw.githubusercontent.com/nats-io/csharp-nats-streaming/master/LICENSE + https://github.com/nats-io/csharp-nats-streaming + false + NATS acts as a central nervous system for distributed systems at scale, such as mobile devices, IoT networks, and cloud native infrastructure. This is the .NET Streaming client API. + NATS Streaming .NET Client + Bug fixes. + Copyright 2017 Apcera, Inc. + + Apcera NATS Messaging Cloud Publish Subscribe PubSub Streaming Persistence + + + + + + + + + + + + + diff --git a/nuget/build_pkg.bat b/nuget/build_pkg.bat old mode 100755 new mode 100644 index 35d894d..63a2cef --- a/nuget/build_pkg.bat +++ b/nuget/build_pkg.bat @@ -1,49 +1,56 @@ -@setlocal -@echo off - -REM This builds the NATS Streaming .NET Client NuGet package, and is -REM intended for use by Apcera to create NuGet Packages. - -nuget >nul 2>&1 -if errorlevel 9009 if not errorlevel 9010 ( - echo 'nuget.exe' is not in the path. - goto End -) - -set STAN_CLIENT=..\STAN.Client\bin\Release\STAN.Client.DLL -set STAN_CLIENT_XML=..\STAN.Client\bin\Release\STAN.Client.XML - -if NOT EXIST %STAN_CLIENT% ( - echo Cannot find %STAN_CLIENT% - goto End -) - - -if NOT EXIST %STAN_CLIENT_XML% ( - echo Cannot find %STAN_CLIENT_XML% - goto End -) - -mkdir tmp 2>NUL -mkdir tmp\lib 2>NUL -mkdir tmp\lib\net45 2>NUL - -copy %STAN_CLIENT% tmp\lib\net45 1>NUL -copy %STAN_CLIENT_XML% tmp\lib\net45 1>NUL - - -REM (to recreate) nuget spec -f -Verbosity detailed -AssemblyPath NATS.Client.DLL - -cd tmp - -copy ..\STAN.Client.nuspec . 1>NUL - -nuget pack STAN.Client.nuspec - -move *.nupkg .. 1>NUL - -cd .. - -:End - -rmdir /S /Q tmp 2>NUL +@setlocal +@echo off + +REM This builds the NATS Streaming .NET Client NuGet package, and is +REM intended for use by Apcera to create NuGet Packages. + +nuget >nul 2>&1 +if errorlevel 9009 if not errorlevel 9010 ( + echo 'nuget.exe' is not in the path. + goto End +) + +set STAN_CLIENT_45=..\net45\STAN.Client\bin\Release\STAN.Client.DLL +set STAN_CLIENT_XML_45=..\net45\STAN.Client\bin\Release\STAN.Client.XML +set STAN_CORE_DIR=..\STAN.Client\bin\Release\netstandard1.6 + +if NOT EXIST %STAN_CLIENT_45% ( + echo Cannot find %STAN_CLIENT_45% + goto End +) + + +if NOT EXIST %STAN_CLIENT_XML_45% ( + echo Cannot find %STAN_CLIENT_XML_45% + goto End +) + +if NOT EXIST %STAN_CORE_DIR% ( + echo Cannot find .NET core build. + goto End +) + +mkdir tmp 2>NUL +mkdir tmp\lib 2>NUL +mkdir tmp\lib\net45 2>NUL +mkdir tmp\lib\netstandard1.6 2>NUL + +copy %STAN_CLIENT_45% tmp\lib\net45 1>NUL +copy %STAN_CLIENT_XML_45% tmp\lib\net45 1>NUL +copy %STAN_CORE_DIR%\* tmp\lib\netstandard1.6 1>NUL + +REM (to recreate) nuget spec -f -Verbosity detailed -AssemblyPath STAN.Client.DLL + +cd tmp + +copy ..\STAN.Client.nuspec . 1>NUL + +nuget pack STAN.Client.nuspec + +move *.nupkg .. 1>NUL + +cd .. + +:End + +rmdir /S /Q tmp 2>NUL