예제 #1
0
        public IWorkerRoleHeartBeat Initialize()
        {
            // Set role heartbeat
            _heartbeatTimeObservable = Observable.Interval(TimeSpan.FromSeconds(PinkoConfiguration.HeartbeatIntervalSec), Scheduler.ThreadPool);

            _outboundMessageBus = PinkoApplication.GetBus<IBusMessageOutbound>();

            // Send heartbeat
            _heartbeatTimeObservable
                .Subscribe(x => _outboundMessageBus.Publish(
                    new PinkoServiceMessageEnvelop(PinkoApplication)
                    {
                        QueueName = PinkoConfiguration.PinkoMessageBusToWebRolesAllTopic,
                        Message = new PinkoMsgRoleHeartbeat()
                    }));

            return this;
        }
예제 #2
0
        /// <summary>
        /// Start Heart Beat
        /// </summary>
        public void StartHeartBeat()
        {
            // Set role heartbeat
            _heartbeatTimeObservable = Observable.Interval(TimeSpan.FromSeconds(PinkoContainer.Resolve<IPinkoConfiguration>().HeartbeatIntervalSec), Scheduler.ThreadPool);

            _outboundMessageBus = PinkoApplication.GetBus<IBusMessageOutbound>();

            // Send heartbeat
            _heartbeatTimeObservable
                .Subscribe(x => _outboundMessageBus.Publish(PinkoServiceMessageEnvelop.FactorClientMessage(PinkoContainer.Resolve<IPinkoConfiguration>().MessageBusWebRoleToClientsTopic,
                                                                                                    new PinkoRoleHeartbeat
                                                                                                    {
                                                                                                        ResponderDateTime = DateTime.Now,
                                                                                                        ResponderMachine = PinkoApplication .MachineName
                                                                                                    })));
        }