update consumer
This commit is contained in:
@@ -15,7 +15,7 @@ class Platform extends Model
|
|||||||
*
|
*
|
||||||
* @TODO check if we realy need the platform table, or consider use a virtual model
|
* @TODO check if we realy need the platform table, or consider use a virtual model
|
||||||
*/
|
*/
|
||||||
# protected ?string $table = 'Platform';
|
protected ?string $table = 'platforms';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
|
|||||||
@@ -13,10 +13,25 @@ use Hyperf\Di\Annotation\Inject;
|
|||||||
use Hyperf\DbConnection\Db;
|
use Hyperf\DbConnection\Db;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
#[Consumer(exchange: "main.exchange", routingKey: "order.#", queue: "orders.queue", nums: 1, enable: true)]
|
#[Consumer(exchange: "main.exchange", routingKey: "order.#", queue: "orders.queue", pool: "default_consumer", nums: 1, enable: true)]
|
||||||
class OrderConsumer extends ConsumerMessage
|
class OrderConsumer extends ConsumerMessage
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 队列参数配置
|
||||||
|
* 必须与 RabbitMQ 中现有队列的参数完全一致,否则会报 PRECONDITION_FAILED 错误
|
||||||
|
*
|
||||||
|
* 参数说明:
|
||||||
|
* - x-message-ttl: 消息存活时间(毫秒),24小时 = 86400000ms
|
||||||
|
* - x-dead-letter-exchange: 死信交换机,用于重试机制
|
||||||
|
* - x-dead-letter-routing-key: 死信路由键
|
||||||
|
*/
|
||||||
|
protected array $queueOptions = [
|
||||||
|
'x-message-ttl' => ['I', 86400000], // 24小时 TTL
|
||||||
|
'x-dead-letter-exchange' => ['S', 'dlx.orders'], // 死信交换机
|
||||||
|
'x-dead-letter-routing-key' => ['S', 'retry'], // 死信路由键
|
||||||
|
];
|
||||||
|
|
||||||
protected ?array $qos = [
|
protected ?array $qos = [
|
||||||
// AMQP 默认并没有实现此配置。
|
// AMQP 默认并没有实现此配置。
|
||||||
'prefetch_size' => 0,
|
'prefetch_size' => 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user