-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNatsService.cs
More file actions
39 lines (33 loc) · 936 Bytes
/
NatsService.cs
File metadata and controls
39 lines (33 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using NATS.Client;
using SyntropyNet.PubSub.Sdk;
using System;
using System.Threading.Tasks;
namespace Syntropy.DataLayer.Sdk
{
public class NatsService : INatsService
{
private readonly Options _options;
private readonly IConnection _connection;
public NatsService(string url)
{
_options = ConnectionFactory.GetDefaultOptions(url);
_connection ??= new ConnectionFactory().CreateConnection(_options);
}
public void AddHandler(string subject, Action handler)
{
throw new NotImplementedException();
}
public void Publish(string subject, byte[] data)
{
_connection.Publish(subject, data);
}
public Task ServeAsync()
{
throw new NotImplementedException();
}
public void Dispose()
{
_connection.Dispose();
}
}
}