Exemplo n.º 1
0
        public EventMessage GetMessage(EventMessageIdentifier identifier)
        {
            var sqlIdentifier = identifier as SqlEventMessageIdentifier;

            if (sqlIdentifier == null)
            {
                return(null);
            }

            EventMessage message = null;

            using (var connection = new SqlConnection(_connectionString))
            {
                connection.Open();

                using (var command = new SqlCommand(Sql.GetMessage, connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@messageId", SqlDbType.Int).Value = sqlIdentifier.Id;

                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            message = ReadMessage(reader);
                        }
                    }
                }
            }

            return(message);
        }
Exemplo n.º 2
0
        public EventMessages GetMessages(EventMessageIdentifier startIdentifier, EventMessageIdentifier endIdentifier)
        {
            var messages = new EventMessages();

            var sqlStartIdentifier = startIdentifier as SqlEventMessageIdentifier;
            var sqlEndIdentifier   = endIdentifier as SqlEventMessageIdentifier;

            if (sqlStartIdentifier == null || sqlEndIdentifier == null)
            {
                return(messages);
            }

            var eventFilter = GetEventFilter();

            if (eventFilter == null)
            {
                GetMessages(messages, sqlStartIdentifier, sqlEndIdentifier);
            }
            else
            {
                GetMessages(messages, sqlStartIdentifier, sqlEndIdentifier, eventFilter);
            }

            return(messages);
        }
Exemplo n.º 3
0
 protected void HandleEventMessage(EventMessageIdentifier identifier)
 {
     _messageNotifyHandler.HandleEventMessage(identifier);
 }