Пример #1
0
        public void MessagingInfoLog(DateTime?loggedOn, string logBy, string busType, string subscriberType, string publisherType, string adapterType, string message, System.Exception occurredException)
        {
            var occuredExceptionStck = occurredException != null?ExceptionStub.CreateExceptionStubXML(occurredException) : string.Empty;

            const string insertQuery = @"INSERT INTO [MessagingInfoLog] ([LoggedOn],[LogBy],[BusType],[SubscriberType],[PublisherType],[AdapterType],[Message],[ExceptionType],[ExceptionStack]) VALUES 
                                       (@LoggedOn, @LogBy,@BusType,@SubscriberType, @PublisherType, @AdapterType,@Message,@ExceptionType, @ExceptionStack)";

            IList <SqlParameter> sqlParameters = new List <SqlParameter>
            {
                new SqlParameter
                {
                    ParameterName = "@LoggedOn",
                    SqlDbType     = SqlDbType.DateTime,
                    Value         = loggedOn.HasValue && (loggedOn.Value != DateTime.MinValue) ?loggedOn.Value:SqlDateTime.Null
                },
                new SqlParameter
                {
                    ParameterName = "@LogBy",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = logBy.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@BusType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = busType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@SubscriberType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = subscriberType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@PublisherType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = publisherType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@AdapterType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = adapterType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@Message",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = message.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = occurredException != null?occurredException.GetType().FullName : SqlString.Null
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionStack",
                    SqlDbType     = SqlDbType.Xml,
                    Value         = occuredExceptionStck
                }
            };

            AddData(insertQuery, sqlParameters);
        }
Пример #2
0
        public void MessagingSubscriberLog(Guid?messageUId, DateTime?loggedOn, string subscriberType, bool isSuccess, string message, int retryCount, System.Exception occurredException,
                                           bool isFatal, bool isRetryAllowed, int retryIntervalInMs, bool isCommandMessage, string retryMessageSubscribers, int retryMessageId, string environment)
        {
            string occuredExceptionStck = occurredException != null?ExceptionStub.CreateExceptionStubXML(occurredException) : string.Empty;

            const string insertQuery = @"INSERT INTO [Ensemble].[MessagingSubscriberLog] ([MessageUID],[LoggedOn],[SubscriberType],[IsSuccess],[Message],[RetryCount],[ExceptionType],[ExceptionStack],[IsFatal],[IsRetryAllowed],[RetryIntervalInMs],[IsCommandMessage],[RetryMessageSubscribers],[retryMessageId],[Environment]) VALUES 
                                 (@MessageUID,@LoggedOn, @SubscriberType, @IsSuccess, @Message, @RetryCount,@ExceptionType, @ExceptionStack, @IsFatal, @IsRetryAllowed, @RetryIntervalInMs, @IsCommandMessage, @RetryMessageSubscribers, @RetryMessageId,@Environment)";

            IList <SqlParameter> sqlParameters = new List <SqlParameter>
            {
                new SqlParameter
                {
                    ParameterName = "@MessageUID",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = messageUId.HasValue ? messageUId.Value.ToString() : SqlString.Null
                },
                new SqlParameter
                {
                    ParameterName = "@LoggedOn",
                    SqlDbType     = SqlDbType.DateTime,
                    Value         = loggedOn.HasValue && (loggedOn.Value != DateTime.MinValue) ?loggedOn.Value:SqlDateTime.Null
                },
                new SqlParameter
                {
                    ParameterName = "@SubscriberType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = subscriberType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@IsSuccess",
                    SqlDbType     = SqlDbType.Bit,
                    Value         = isSuccess
                },
                new SqlParameter
                {
                    ParameterName = "@Message",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = string.IsNullOrEmpty(message) ? SqlString.Null : message.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@RetryCount",
                    SqlDbType     = SqlDbType.SmallInt,
                    Value         = retryCount
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = occurredException != null?occurredException.GetType().FullName : SqlString.Null
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionStack",
                    SqlDbType     = SqlDbType.Xml,
                    Value         = occuredExceptionStck
                },
                new SqlParameter
                {
                    ParameterName = "@IsFatal",
                    SqlDbType     = SqlDbType.Bit,
                    Value         = isFatal
                },
                new SqlParameter
                {
                    ParameterName = "@IsRetryAllowed",
                    SqlDbType     = SqlDbType.Bit,
                    Value         = isRetryAllowed
                },
                new SqlParameter
                {
                    ParameterName = "@RetryIntervalInMs",
                    SqlDbType     = SqlDbType.Int,
                    Value         = retryIntervalInMs
                },
                new SqlParameter
                {
                    ParameterName = "@IsCommandMessage",
                    SqlDbType     = SqlDbType.Bit,
                    Value         = isCommandMessage
                },
                new SqlParameter
                {
                    ParameterName = "@RetryMessageSubscribers",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = retryMessageSubscribers.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@RetryMessageId",
                    SqlDbType     = SqlDbType.Int,
                    Value         = retryMessageId
                },
                new SqlParameter
                {
                    ParameterName = "@Environment",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = environment != null?environment:SqlString.Null
                }
            };

            AddData(insertQuery, sqlParameters);
        }
Пример #3
0
        public void MessagingPublisherLog(IMessageEnvelope envelope, string publisherType, bool isSuccess, string message, System.Exception occurredException)
        {
            string environment = ConfigurationHelper.GetEnvironment(envelope);
            JSONMessageSerializer serializer = new JSONMessageSerializer();
            string envelopeString            = serializer.SerializeEnvelope(envelope);
            string occuredExceptionStack     = occurredException != null?ExceptionStub.CreateExceptionStubXML(occurredException) : string.Empty;

            const string insertQuery = @"INSERT INTO [Ensemble].[MessagingPublisherLog] ([MessageUID],[MessageSentOn],[MessageType],[Topic],[Originator],[UserName],[ReplyTo],[ReplyOf],[PublisherType]
                                 ,[IsSuccess],[Message],[MessageEnvelope],[ExceptionType],[ExceptionStack],[Environment]) VALUES 
                                 (@MessageUID,@MessageSentOn, @MessageType,@Topic,@Originator, @UserName, @ReplyTo, @ReplyOf, @PublisherType, @IsSuccess, @Message, @MessageEnvelope,
                                 @ExceptionType, @ExceptionStack, @Environment)";

            IList <SqlParameter> sqlParameters = new List <SqlParameter>
            {
                new SqlParameter
                {
                    ParameterName = "@MessageUID",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.MessageUID.ToString().ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@MessageSentOn",
                    SqlDbType     = SqlDbType.DateTime,
                    Value         = envelope.MessageSentOn.ToSqlDateTime()
                },
                new SqlParameter
                {
                    ParameterName = "@MessageType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.MessageType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@Topic",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.Topic.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@Originator",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.Originator.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@UserName",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.User.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@ReplyTo",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.ReplyTo.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@ReplyOf",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelope.ReplyOf.ToString().ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@PublisherType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = publisherType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@IsSuccess",
                    SqlDbType     = SqlDbType.Bit,
                    Value         = isSuccess
                },
                new SqlParameter
                {
                    ParameterName = "@Message",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = message.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@MessageEnvelope",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = envelopeString
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = occurredException != null?occurredException.GetType().FullName : SqlString.Null
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionStack",
                    SqlDbType     = SqlDbType.Xml,
                    Value         = occuredExceptionStack
                },
                new SqlParameter
                {
                    ParameterName = "@Environment",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = environment != null?environment : SqlString.Null
                }
            };

            AddData(insertQuery, sqlParameters);
        }
Пример #4
0
        public void MessagingHostLog(Guid?messageUId, DateTime?loggedOn, string hostInstance, string busType, bool isSuccess, string message, System.Exception occurredException, string environment)
        {
            var occuredExceptionStck = occurredException != null?ExceptionStub.CreateExceptionStubXML(occurredException) : string.Empty;

            const string insertQuery = @"INSERT INTO [Ensemble].[MessagingHostLog] ([MessageUID],[LoggedOn],[HostInstance],[BusType],[IsSuccess],[Message],[ExceptionType],[ExceptionStack],[Environment]) VALUES 
                                 (@MessageUID,@LoggedOn, @HostInstance,@BusType,@IsSuccess, @Message, 
                                 @ExceptionType, @ExceptionStack,@Environment)";

            SqlString   sqlString   = SqlString.Null;
            SqlDateTime sqlDateTime = SqlDateTime.Null;

            IList <SqlParameter> sqlParameters = new List <SqlParameter>
            {
                new SqlParameter
                {
                    ParameterName = "@MessageUID",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = messageUId.HasValue ? messageUId.Value.ToString() : SqlString.Null
                },
                new SqlParameter
                {
                    ParameterName = "@LoggedOn",
                    SqlDbType     = SqlDbType.DateTime,
                    Value         = loggedOn.HasValue && (loggedOn.Value != DateTime.MinValue) ?loggedOn.Value:SqlDateTime.Null
                },
                new SqlParameter
                {
                    ParameterName = "@HostInstance",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = hostInstance.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@BusType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = busType.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@IsSuccess",
                    SqlDbType     = SqlDbType.Bit,
                    Value         = isSuccess
                },
                new SqlParameter
                {
                    ParameterName = "@Message",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = message.ToSqlString()
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionType",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = occurredException != null?occurredException.GetType().FullName : SqlString.Null
                },
                new SqlParameter
                {
                    ParameterName = "@ExceptionStack",
                    SqlDbType     = SqlDbType.Xml,
                    Value         = occuredExceptionStck
                },
                new SqlParameter
                {
                    ParameterName = "@Environment",
                    SqlDbType     = SqlDbType.VarChar,
                    Value         = environment != null?environment : SqlString.Null
                }
            };

            AddData(insertQuery, sqlParameters);
        }