コード例 #1
0
ファイル: ServerPump.cs プロジェクト: SmartFire/ShortBus
 /// <summary>
 /// Send a message to a subscription
 /// </summary>
 /// <param name="subscription">The subscription the message is destined for</param>
 /// <param name="data">The message to send to the subscriber</param>
 void SendMessage(Subscriber subscription, ServiceBusEvent data)
 {
     if (!clients.ContainsKey(subscription.SubscriberId))
         clients.Add(subscription.SubscriberId, ClientFactory.Connect(subscription.Endpoint));
     try
     {
         clients[subscription.SubscriberId].Consume(data);
         Debug.WriteLine("Sent event {0} to client {1}", data.EventName, subscription.SubscriberId);
     }
     catch (EndpointNotFoundException)
     {
         Unsubscribe(subscription.SubscriberId);
     }
 }
コード例 #2
0
ファイル: ServerPump.cs プロジェクト: SmartFire/ShortBus
        /// <summary>
        /// Removes a subscriber that didn't respond to a heartbeat request
        /// </summary>
        /// <param name="sub"></param>
        void SubscriberTimedOut(Subscriber sub)
        {
            Debug.WriteLine("Not feeling a pulse for {0}", sub.SubscriberId);

            Storage.RemoveSubscriber(sub.SubscriberId);
            HeartbeatMonitorList.Remove(sub.SubscriberId);
        }
コード例 #3
0
ファイル: ServerPump.cs プロジェクト: SmartFire/ShortBus
 /// <summary>
 /// Sends a heartbeat message to a given subscription
 /// </summary>
 /// <param name="sub">The subscription to ping</param>
 void SendHeartBeat(Subscriber sub)
 {
     if (!clients.ContainsKey(sub.SubscriberId))
         clients.Add(sub.SubscriberId, ClientFactory.Connect(sub.Endpoint));
     try
     {
         Debug.WriteLine("Checking {0} for a pulse", sub.SubscriberId);
         clients[sub.SubscriberId].Heartbeat();
         HeartbeatMonitorList.Add(sub.SubscriberId);
     }
     catch (EndpointNotFoundException)
     {
         Unsubscribe(sub.SubscriberId);
     }
 }