//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 10/11/2018 Created [Fabian Sauter] /// </history> public PubSubSubscription(XmlNode node) { NODE = node.Attributes["node"]?.Value; JID = node.Attributes["jid"]?.Value; if (!Enum.TryParse(node.Attributes[""]?.Value, out SUBSCRIPTION)) { SUBSCRIPTION = PubSubSubscriptionState.NONE; } SUB_ID = node.Attributes["subid"]?.Value; }
async Task<ISet<PubSubSubscriptionState>> IStreamPubSub.RegisterProducer(StreamId streamId, string streamProvider, IStreamProducerExtension streamProducer) { var matches = new PubSubSubscriptionState[0]; if (ShouldMatch(streamProvider)) { matches = (from StreamPubSubMatch m in matcher(new StreamIdentity(streamId)) let subId = GuidId.GetNewGuidId() select new PubSubSubscriptionState(subId, streamId, new PushExtension(m), null)) .ToArray(); } var registered = await registry.RegisterProducer(streamId, streamProvider, streamProducer); registered.UnionWith(matches); return registered; }
async Task <ISet <PubSubSubscriptionState> > IStreamPubSub.RegisterProducer(StreamId streamId, string streamProvider, IStreamProducerExtension streamProducer) { var matches = new PubSubSubscriptionState[0]; if (ShouldMatch(streamProvider)) { matches = (from StreamPubSubMatch m in matcher(new StreamIdentity(streamId)) let subId = GuidId.GetNewGuidId() select new PubSubSubscriptionState(subId, streamId, new PushExtension(m), null)) .ToArray(); } var registered = await registry.RegisterProducer(streamId, streamProvider, streamProducer); registered.UnionWith(matches); return(registered); }
//--------------------------------------------------------Constructor:----------------------------------------------------------------\\ #region --Constructors-- /// <summary> /// Basic Constructor /// </summary> /// <history> /// 17/07/2018 Created [Fabian Sauter] /// </history> public PubSubSubscriptionMessage(XmlNode n) : base(n) { XmlNode pubSub = getPubSubNode(n); if (!(pubSub is null)) { XmlNode subNode = XMLUtils.getChildNode(pubSub, "subscription"); if (!(subNode is null)) { this.NODE_NAME = subNode.Attributes["node"]?.Value; this.JID = subNode.Attributes["jid"]?.Value; this.SUBID = subNode.Attributes["subid"]?.Value; if (!Enum.TryParse(subNode.Attributes["subscription"]?.Value?.ToUpper(), out this.SUBSCRIPTION)) { this.SUBSCRIPTION = PubSubSubscriptionState.NONE; } } } }