예제 #1
0
        public void SendEvent(Sensor sensor)
        {
            try
            {
                service.SendEvent(sensor);
                //service.SendEventAsync(sensor);

                Log.DebugFormat("Send Event #{1}: {0}", sensor.ToString(), ++eventsSentCount);
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Sending Event failed: {0}", e.Message);

                lock (reconnectLock)
                {
                    if (service.State == System.ServiceModel.CommunicationState.Faulted)
                    {
                        Log.Warn("Creating new service client");
                        service = new EventReceiverService.EventReceiverServiceClient();
                    }
                }
            }
        }
        /// <summary>
        /// Sends an event to the CEP Server
        /// </summary>
        /// <param name="obj">the event</param>
        public void SendEvent(Sensor obj)
        {
            Log.DebugFormat("Received Event #{1} at {2}: {0}", obj.ToString(), ++eventsReceivedCount, this.GetHashCode());

            epService.EPRuntime.SendEvent(obj);
        }