-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sink.cs
32 lines (27 loc) · 819 Bytes
/
Sink.cs
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
using System.Collections.Concurrent;
using MTConnect.Applications;
namespace MTCAgentTest;
public class Sink
{
public ConcurrentBag<Message> Inbox { get; set; }
private Disruptor.Dsl.Disruptor<Message> _disruptor;
private MTConnectAgentApplication _sink = null;
private Module _module = null;
public Sink(Disruptor.Dsl.Disruptor<Message> disruptor)
{
Inbox = new ConcurrentBag<Message>();
_disruptor = disruptor;
_disruptor.HandleEventsWith(new InboundMessageHandler(this));
_sink = new MTConnectAgentApplication();
}
public void Start()
{
_sink.Run(["run", "MtConnectAgentSink.yaml"], false);
_module = new Module(_sink.Agent, this);
_module.Start();
}
public void Stop()
{
_module.Stop();
}
}