Ejemplo n.º 1
0
 public virtual string GetStatus()
 {
     return(WorkerStatus.ToString(Interlocked.CompareExchange(ref status, 0, 0)));
 }
Ejemplo n.º 2
0
 public virtual string GetStatus()
 {
     return("[Worker: {0}, Status: {1}, ThreadStatus: {2}, LastMsgAt: {3}]"
            .Fmt(QueueName, WorkerStatus.ToString(status), bgThread.ThreadState, LastMsgProcessed));
 }
        /// <summary>
        /// Updates the status of the worker with the given ID.
        /// </summary>
        /// <param name="id">The ID of the worker to update status for.</param>
        /// <param name="status">The status to update.</param>
        /// <param name="transaction">The transaction to use, if applicable.</param>
        public void UpdateWorkerStatus(long id, WorkerStatus status, IDbTransaction transaction)
        {
            const string Sql =
            @"UPDATE [BlueCollarWorker]
            SET
            [Status] = @Status,
            [UpdatedOn] = @Now
            WHERE
            [Id] = @Id;";

            this.connection.Execute(
                Sql,
                new
                {
                    Id = id,
                    Now = DateTime.UtcNow,
                    Status = status.ToString()
                },
                transaction,
                null,
                null);
        }