- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
108 lines
2.4 KiB
PHP
108 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Queue\ValueObjects;
|
|
|
|
/**
|
|
* Queue Priority Value Object
|
|
*
|
|
* Represents the priority of a job in the queue system.
|
|
* Higher values mean higher priority.
|
|
*/
|
|
final readonly class QueuePriority
|
|
{
|
|
public const CRITICAL = 1000;
|
|
public const HIGH = 100;
|
|
public const NORMAL = 0;
|
|
public const LOW = -100;
|
|
public const DEFERRED = -1000;
|
|
|
|
public function __construct(
|
|
public int $value
|
|
) {
|
|
if ($value < -1000 || $value > 1000) {
|
|
throw new \InvalidArgumentException(
|
|
sprintf('Priority must be between -1000 and 1000, got %d', $value)
|
|
);
|
|
}
|
|
}
|
|
|
|
public static function critical(): self
|
|
{
|
|
return new self(self::CRITICAL);
|
|
}
|
|
|
|
public static function high(): self
|
|
{
|
|
return new self(self::HIGH);
|
|
}
|
|
|
|
public static function normal(): self
|
|
{
|
|
return new self(self::NORMAL);
|
|
}
|
|
|
|
public static function low(): self
|
|
{
|
|
return new self(self::LOW);
|
|
}
|
|
|
|
public static function deferred(): self
|
|
{
|
|
return new self(self::DEFERRED);
|
|
}
|
|
|
|
public function isHigherThan(self $other): bool
|
|
{
|
|
return $this->value > $other->value;
|
|
}
|
|
|
|
public function isLowerThan(self $other): bool
|
|
{
|
|
return $this->value < $other->value;
|
|
}
|
|
|
|
public function equals(self $other): bool
|
|
{
|
|
return $this->value === $other->value;
|
|
}
|
|
|
|
public function isCritical(): bool
|
|
{
|
|
return $this->value >= self::CRITICAL;
|
|
}
|
|
|
|
public function isHigh(): bool
|
|
{
|
|
return $this->value >= self::HIGH && $this->value < self::CRITICAL;
|
|
}
|
|
|
|
public function isNormal(): bool
|
|
{
|
|
return $this->value > self::LOW && $this->value < self::HIGH;
|
|
}
|
|
|
|
public function isLow(): bool
|
|
{
|
|
return $this->value > self::DEFERRED && $this->value <= self::LOW;
|
|
}
|
|
|
|
public function isDeferred(): bool
|
|
{
|
|
return $this->value <= self::DEFERRED;
|
|
}
|
|
|
|
public function toString(): string
|
|
{
|
|
return match (true) {
|
|
$this->isCritical() => 'critical',
|
|
$this->isHigh() => 'high',
|
|
$this->isNormal() => 'normal',
|
|
$this->isLow() => 'low',
|
|
$this->isDeferred() => 'deferred',
|
|
default => sprintf('custom(%d)', $this->value)
|
|
};
|
|
}
|
|
}
|