コード例 #1
0
 public Task SendMessage(VelocityMessage message)
 {
     // add a message to the send queue
     messageQueue.Add(message);
     if (messageQueue.Count > 25)
     {
         // if the queue size is greater than 25, flush the queue
         Flush();
     }
     return(TaskDone.Done);
 }
コード例 #2
0
ファイル: DeviceGrain.cs プロジェクト: veikkoeeva/orleans
        public async Task ProcessMessage(DeviceMessage message)
        {
            if (_lastMessage is null || _lastMessage.Latitude != message.Latitude || _lastMessage.Longitude != message.Longitude)
            {
                // Only sent a notification if the position has changed
                var notifier = GrainFactory.GetGrain <IPushNotifierGrain>(0);
                var speed    = GetSpeed(_lastMessage, message);

                // Record the last message
                _lastMessage = message;

                // Forward the message to the notifier grain
                var velocityMessage = new VelocityMessage(message, speed);
                await notifier.SendMessage(velocityMessage);
            }
コード例 #3
0
        public async Task ProcessMessage(DeviceMessage message)
        {
            if (null == this.LastMessage || this.LastMessage.Latitude != message.Latitude || this.LastMessage.Longitude != message.Longitude)
            {
                // only sent a notification if the position has changed
                var notifier = GrainFactory.GetGrain <IPushNotifierGrain>(0);
                var speed    = GetSpeed(this.LastMessage, message);

                // record the last message
                this.LastMessage = message;

                // forward the message to the notifier grain
                var velocityMessage = new VelocityMessage(message, speed);
                await notifier.SendMessage(velocityMessage);
            }
            else
            {
                // the position has not changed, just record the last message
                this.LastMessage = message;
            }
        }
コード例 #4
0
ファイル: Pilot.cs プロジェクト: milanm/FastAndFuriousNet
 public void OnVelocityMessage(VelocityMessage velocityMessage)
 {
     pilotApi.SetPower(SafePower);
 }
コード例 #5
0
ファイル: LocationHub.cs プロジェクト: RIntegerB2B/orleans-1
 public void LocationUpdate(VelocityMessage message)
 {
     // Forward a single messages to all browsers
     Clients.Group("BROWSERS").locationUpdate(message);
 }