Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
EventQueueEventSinkNode.cs
2using System.Threading.Tasks;
3using System.Xml;
7using Waher.Things;
10
12{
17 {
22 : base()
23 {
24 }
25
35 string SinkId, string Queue, int DeleteAfterDays)
36 : base(Source, Parent, SinkId)
37 {
38 this.Queue = Queue;
39 this.DeleteAfterDays = DeleteAfterDays;
40 }
41
45 [Page(7, "Configuration")]
46 [Header(250, "Queue Name:")]
47 [ToolTip(251, "Name of local queue to which events will be logged.")]
48 [Required]
49 public string Queue { get; set; }
50
54 [Page(7, "Configuration")]
55 [Header(150, "Delete After Days:")]
56 [ToolTip(258, "Number of days after which log events are purged from queue.")]
57 [Required]
58 [Range(1, int.MaxValue)]
59 public int DeleteAfterDays { get; set; }
60
65 public override Task<string> GetTypeNameAsync(Language Language)
66 {
67 return Language.GetStringAsync(typeof(GatewayConfigSource), 252, "Event Queue Event Sink");
68 }
69
76 public override async Task<IEnumerable<Parameter>> GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
77 {
78 LinkedList<Parameter> Parameters = (LinkedList<Parameter>)await base.GetDisplayableParametersAsync(Language, Caller);
80
81 Parameters.AddLast(new StringParameter("Queue", await Namespace.GetStringAsync(253, "Queue"), this.Queue));
82
83 return Parameters;
84 }
85
90 public override void Export(XmlWriter Output)
91 {
92 Output.WriteStartElement("EventQueue");
93 Output.WriteAttributeString("id", this.SinkId);
94 Output.WriteAttributeString("name", this.Queue);
95 Output.WriteAttributeString("deleteAfterDays", this.DeleteAfterDays.ToString());
96 Output.WriteEndElement();
97 }
98
102 public override bool HasCommands => true;
103
107 public override Task<IEnumerable<ICommand>> Commands => this.GetCommands();
108
109 private Task<IEnumerable<ICommand>> GetCommands()
110 {
111 return Task.FromResult<IEnumerable<ICommand>>(new ICommand[]
112 {
113 new ClearQueueCommand(this.Queue)
114 });
115 }
116 }
117}
Contains information about a language.
Definition: Language.cs:17
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Definition: Language.cs:209
async Task< Namespace > GetNamespaceAsync(string Name)
Gets the namespace object, given its name, if available.
Definition: Language.cs:99
Contains information about a namespace in a language.
Definition: Namespace.cs:17
Task< LanguageString > GetStringAsync(int Id)
Gets the string object, given its ID, if available.
Definition: Namespace.cs:65
Abstract base class for gateway configuration nodes.
virtual INode Parent
Parent Node, or null if a root node.
GatewayConfigSource Source
Source hosting the node.
Abstract base class for event sink nodes.
override void Export(XmlWriter Output)
Exports the event sink definition to XML.
override Task< string > GetTypeNameAsync(Language Language)
Gets the type name of the node.
override Task< IEnumerable< ICommand > > Commands
Available command objects. If no commands are available, null is returned.
override async Task< IEnumerable< Parameter > > GetDisplayableParametersAsync(Language Language, RequestOrigin Caller)
Gets displayable parameters.
EventQueueEventSinkNode(GatewayConfigSource Source, ConfigurationNode Parent, string SinkId, string Queue, int DeleteAfterDays)
Representation of a EventQueue
Tokens available in request.
Definition: RequestOrigin.cs:9
Interface for commands.
Definition: ICommand.cs:32