-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathQueueServiceModule.cs
More file actions
51 lines (44 loc) · 1.12 KB
/
QueueServiceModule.cs
File metadata and controls
51 lines (44 loc) · 1.12 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
using System.Threading.Tasks;
using Waher.IoTGateway;
using Waher.Networking.HTTP;
using Waher.Runtime.Inventory;
using Waher.Things.Http;
namespace Waher.WebService.Queue
{
/// <summary>
/// Pluggable module registering a web service endpoint to access local queues.
/// </summary>
[Singleton]
public class QueueServiceModule : IModule
{
private QueueWebService queueEndpoint;
/// <summary>
/// Pluggable module registering a web service endpoint to access local queues.
/// </summary>
public QueueServiceModule()
{
}
/// <summary>
/// Starts the module.
/// </summary>
public Task Start()
{
HttpAuthenticationScheme[] AuthenticationSchemes = HttpModule.GetAuthenticationSchemes();
this.queueEndpoint = new QueueWebService("/Queues", AuthenticationSchemes);
Gateway.HttpServer?.Register(this.queueEndpoint);
return Task.CompletedTask;
}
/// <summary>
/// Stops the module.
/// </summary>
public Task Stop()
{
if (!(Gateway.HttpServer is null))
{
Gateway.HttpServer.Unregister(this.queueEndpoint);
this.queueEndpoint = null;
}
return Task.CompletedTask;
}
}
}