示例#1
0
        internal static void BuildMetaCommand(NpgsqlCommand command,
                                              ITableNameHelper tableNameHelper,
                                              IHeaders headers,
                                              IAdditionalMessageData data,
                                              IMessage message,
                                              long id,
                                              PostgreSqlMessageQueueTransportOptions options,
                                              TimeSpan?delay,
                                              TimeSpan expiration,
                                              DateTime currentDateTime)
        {
            var sbMeta = new StringBuilder();

            sbMeta.AppendLine("Insert into " + tableNameHelper.MetaDataName);
            sbMeta.Append("(QueueID, CorrelationID, QueuedDateTime ");

            //add configurable columns - queue
            options.AddBuiltInColumns(sbMeta);

            //add configurable columns - user
            if (options.AdditionalColumnsOnMetaData)
            {
                AddUserColumns(sbMeta, data);
            }

            //close the column list
            sbMeta.AppendLine(") ");

            //add standard values that are always present
            sbMeta.Append("VALUES (");
            sbMeta.Append("@QueueID, @CorrelationID, now() at time zone 'utc' ");

            //add the values for built in fields
            options.AddBuiltInColumnValues(delay, expiration, currentDateTime, sbMeta);

            //add configurable column value - user
            if (options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsValues(sbMeta, data);
            }

            sbMeta.Append(")"); //close the VALUES

            command.CommandText = sbMeta.ToString();

            options.AddBuiltInColumnsParams(command, data);

            command.Parameters.Add("@QueueID", NpgsqlDbType.Bigint, 8).Value      = id;
            command.Parameters.Add("@CorrelationID", NpgsqlDbType.Uuid, 16).Value = data.CorrelationId.Id.Value;

            //add configurable column command params - user
            if (options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsParams(command, data);
            }
        }
示例#2
0
        internal static void BuildStatusCommand(NpgsqlCommand command,
                                                ITableNameHelper tableNameHelper,
                                                IHeaders headers,
                                                IAdditionalMessageData data,
                                                IMessage message,
                                                long id,
                                                PostgreSqlMessageQueueTransportOptions options)
        {
            var builder = new StringBuilder();

            builder.AppendLine("Insert into " + tableNameHelper.StatusName);
            builder.Append("(QueueID, Status, CorrelationID ");

            //add configurable columns - user
            if (!options.AdditionalColumnsOnMetaData)
            {
                AddUserColumns(builder, data);
            }

            //close the column list
            builder.AppendLine(") ");

            //add standard values that are always present
            builder.Append("VALUES (");
            builder.Append($"@QueueID, {Convert.ToInt32(QueueStatuses.Waiting)}, @CorrelationID");

            //add configurable column value - user
            if (!options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsValues(builder, data);
            }

            builder.Append(")"); //close the VALUES

            command.CommandText = builder.ToString();

            options.AddBuiltInColumnsParams(command, data);

            command.Parameters.Add("@QueueID", NpgsqlDbType.Bigint, 8).Value      = id;
            command.Parameters.Add("@CorrelationID", NpgsqlDbType.Uuid, 16).Value = data.CorrelationId.Id.Value;

            //add configurable column command params - user
            if (!options.AdditionalColumnsOnMetaData)
            {
                AddUserColumnsParams(command, data);
            }
        }
示例#3
0
        internal static void BuildStatusCommand(NpgsqlCommand command,
            TableNameHelper tableNameHelper,
            IHeaders headers,
            IAdditionalMessageData data,
            IMessage message,
            long id,
            PostgreSqlMessageQueueTransportOptions options)
        {
            var builder = new StringBuilder();
            builder.AppendLine("Insert into " + tableNameHelper.StatusName);
            builder.Append("(QueueID, Status, CorrelationID ");

            //add configurable columns - user
            AddUserColumns(builder, data);

            //close the column list
            builder.AppendLine(") ");

            //add standard values that are always present
            builder.Append("VALUES (");
            builder.Append($"@QueueID, {Convert.ToInt32(QueueStatuses.Waiting)}, @CorrelationID");

            //add configurable column value - user
            AddUserColumnsValues(builder, data);

            builder.Append(")"); //close the VALUES 

            command.CommandText = builder.ToString();

            options.AddBuiltInColumnsParams(command, data);

            command.Parameters.Add("@QueueID", NpgsqlDbType.Bigint, 8).Value = id;
            command.Parameters.Add("@CorrelationID", NpgsqlDbType.Uuid, 16).Value = data.CorrelationId.Id.Value;

            //add configurable column command params - user
            AddUserColumnsParams(command, data);
            AddHeaderColumnParams(command, message, headers);
        }
示例#4
0
        internal static void BuildMetaCommand(NpgsqlCommand command, 
            TableNameHelper tableNameHelper,
            IHeaders headers,
            IAdditionalMessageData data,
            IMessage message,
            long id,
            PostgreSqlMessageQueueTransportOptions options,
            TimeSpan? delay, 
            TimeSpan expiration,
            DateTime currentDateTime)
        {
            var sbMeta = new StringBuilder();
            sbMeta.AppendLine("Insert into " + tableNameHelper.MetaDataName);
            sbMeta.Append("(QueueID, CorrelationID, QueuedDateTime ");

            //add configurable columns - queue
            options.AddBuiltInColumns(sbMeta);

            AddHeaderColumns(sbMeta, message, headers);

            //close the column list
            sbMeta.AppendLine(") ");

            //add standard values that are always present
            sbMeta.Append("VALUES (");
            sbMeta.Append("@QueueID, @CorrelationID, now() at time zone 'utc' ");

            //add the values for built in fields
            options.AddBuiltInColumnValues(delay, expiration, currentDateTime, sbMeta);

            AddHeaderValues(sbMeta, message, headers);

            sbMeta.Append(")"); //close the VALUES 

            command.CommandText = sbMeta.ToString();

            options.AddBuiltInColumnsParams(command, data);
            AddHeaderColumnParams(command, message, headers);

            command.Parameters.Add("@QueueID", NpgsqlDbType.Bigint, 8).Value = id;
            command.Parameters.Add("@CorrelationID", NpgsqlDbType.Uuid, 16).Value = data.CorrelationId.Id.Value;

        }