Esempio n. 1
0
        public void EventHappend(EventDto eventDto)
        {
            eventDto.ClientId = _configuration.ClientId.Value;

            var restResponse = JarvisRestClient.Execute<ResultDto>(new TriggerRequest(){EventDto = eventDto}, "POST");

            JarvisRestClient.CheckForException(restResponse.ResponseStatus);
        }
Esempio n. 2
0
        public void eventRaised(ITransactionScope transactionScope, EventDto eventDto)
        {
            var client = _clientRepository.GetById(transactionScope, eventDto.ClientId);

            var raisedEvent = new Event()
                                  {
                                      EventGroupType = eventDto.EventGroupType,
                                      EventType = eventDto.EventType,
                                      TriggeredDate = eventDto.TriggeredDate,
                                      Data = eventDto.Data,
                                      Client = client
                                  };

            _eventRepository.Save(transactionScope, raisedEvent);

            var eventhandlerClients = _clientLogic.GetClientByFilterCriteria(transactionScope, new ClientFilterCriteria() { Type = ClientTypeEnum.Eventhandler, IsOnline = true });

            var eventhandlerClient = eventhandlerClients.FirstOrDefault();

            if (eventhandlerClient != null)
            {
                TriggerEventForEventhandlerClient(eventhandlerClient);
            }
        }
Esempio n. 3
0
        private void HandleEvent(List<EventHandlerDto> eventHandlers, EventDto eventDto)
        {
            Log.InfoFormat("EventGroupType: {0}\nEventType: {1}\nClientId: {2}\nTriggeredDate: {3}", eventDto.EventGroupType, eventDto.EventType, eventDto.ClientId, eventDto.TriggeredDate);

            var hittedEventHandler = from eh in eventHandlers
                                     where (eh.EventGroupType == null || eh.EventGroupType == eventDto.EventGroupType)
                                           && (eh.EventType == null || eh.EventType == eventDto.EventType)
                                     select eh;

            foreach (var eventHandlerDto in hittedEventHandler)
            {
                var workflowQueueDto = new WorkflowQueueDto
                    {
                        EventHandlerId = eventHandlerDto.Id,
                        DefinedWorkflowId = eventHandlerDto.DefinedWorkflowId,
                        EventId = eventDto.Id
                    };

                Log.InfoFormat("Hitted Eventhandler: {0}", eventHandlerDto.Id);

                _eventHandlingService.AddWorkflowToQueue(workflowQueueDto);
            }
        }