Beispiel #1
0
 public PublishMessage(string topic, dynamic details, int requestId = 0, bool acknowledge = false, bool excludeMe = true, dynamic arguments = null)
 {
     RequestId   = requestId != 0 ? requestId : UniqueIdGenerationService.GenerateUniqueId();
     Acknowledge = acknowledge;
     ExcludeMe   = excludeMe;
     Topic       = topic;
     Details     = details;
     Arguments   = arguments;
 }
Beispiel #2
0
        public SubscribeMessage(string topic, long requestId = 0, dynamic options = null)
        {
            if (requestId == 0)
            {
                requestId = UniqueIdGenerationService.GenerateUniqueId();
            }

            RequestId = requestId;
            Topic     = topic;
            Options   = options;
        }
        private void OnSubscribe(object sender, SubscribeMessage message)
        {
            var subscriptionId = UniqueIdGenerationService.GenerateUniqueId();

            if (!subscriptions.ContainsKey(message.Topic))
            {
                cache.SubscribeAsync(message.Topic);
                subscriptions.Add(message.Topic, subscriptionId);
            }
            else
            {
                subscriptions[message.Topic] = subscriptionId;
            }


            Send(new SubscribedMessage(message.RequestId, subscriptionId));
        }
Beispiel #4
0
 protected virtual long GetSessionId()
 {
     return(UniqueIdGenerationService.GenerateUniqueId());
 }