Skip to content

Commit

Permalink
.NET Core Support (nats-io#37)
Browse files Browse the repository at this point in the history
[ADDED] .NET Core Support
  • Loading branch information
Colin Sullivan authored and watfordgnf committed Apr 27, 2017
1 parent 6a97a2a commit 0afe7ac
Show file tree
Hide file tree
Showing 64 changed files with 814 additions and 504 deletions.
Binary file modified LICENSE
Binary file not shown.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -154,7 +155,6 @@ var s = c.Subscribe("foo", opts, (obj, args) =>

NATS Streaming subscriptions **do not** support wildcards.


## Advanced Usage

### Asynchronous Publishing
Expand All @@ -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;
```

Expand Down Expand Up @@ -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)
Expand Down
Empty file modified STAN.CLIENT/AsyncSubscription.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/BlockingChannel.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/Consts.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/IStanConnection.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/IStanSubscription.cs
100755 → 100644
Empty file.
8 changes: 4 additions & 4 deletions STAN.CLIENT/Options.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Empty file modified STAN.CLIENT/Properties/AssemblyInfo.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/Protocol.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/ProtocolSerializer.cs
100755 → 100644
Empty file.
19 changes: 19 additions & 0 deletions STAN.CLIENT/STAN.CLIENT.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>23ee6838-d8a6-4787-bafb-2148ef6f5b79</ProjectGuid>
<RootNamespace>STAN.CLIENT</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
Empty file modified STAN.CLIENT/STANExceptions.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/StanAckHandlerArgs.cs
100755 → 100644
Empty file.
3 changes: 1 addition & 2 deletions STAN.CLIENT/StanConnection.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ internal PublishAck(Connection conn, string guid, EventHandler<StanAckHandlerArg

ah = handler;
guidValue = guid;
ackTimer = new Timer(ackTimerCb);
ackTimer.Change(timeout, Timeout.Infinite);
ackTimer = new Timer(ackTimerCb, null, (int)timeout, Timeout.Infinite);
}

internal string GUID
Expand Down
Empty file modified STAN.CLIENT/StanConnectionFactory.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/StanMsg.cs
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/StanMsgHandlerArgs.cs
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion STAN.CLIENT/SubscriptionOptions.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal StanSubscriptionOptions(StanSubscriptionOptions opts)

if (opts.durableName != null)
{
this.durableName = string.Copy(opts.durableName);
durableName = StanOptions.DeepCopy(opts.durableName);
}

manualAcks = opts.manualAcks;
Expand Down
Empty file modified STAN.CLIENT/pb/genproto.bat
100755 → 100644
Empty file.
Empty file modified STAN.CLIENT/pb/protocol.proto
100755 → 100644
Empty file.
25 changes: 25 additions & 0 deletions STAN.CLIENT/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"description": "STAN Client API",
"copyright": "Copyright © Apcera 2017",
"title": "STAN Client",
"version": "0.1.4-*",
"dependencies": {
"NETStandard.Library": "1.6.0",
"NATS.Client": "0.7.0",
"System.Reflection.Extensions": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Serialization.Primitives": "4.3.0",
"System.Threading.Thread": "4.3.0",
"Google.Protobuf": "3.2.0",
"Google.Protobuf.Tools": "3.2.0",
"System.Runtime.Serialization.Json": "4.3.0"
},
"frameworks": {
"netstandard1.6": {
"imports": "dnxcore50"
}
},
"buildOptions": {
"xmlDoc": true
}
}
9 changes: 9 additions & 0 deletions STAN.Client.UnitTests/Nuget.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="STAN.Client" value="../STAN.Client/bin/Release" />
</packageSources>
<config>
<add key="repositoryPath" value="../STAN.Client/bin/Release" />
</config>
</configuration>
Empty file modified STAN.Client.UnitTests/Properties/AssemblyInfo.cs
100755 → 100644
Empty file.
5 changes: 3 additions & 2 deletions STAN.Client.UnitTests/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions STAN.Client.UnitTests/STAN.Client.UnitTests.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0.25420" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.25420</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>9a3ea015-7552-417d-a3d9-698d664e954c</ProjectGuid>
<RootNamespace>STAN.Client.UnitTests</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
Loading

0 comments on commit 0afe7ac

Please sign in to comment.