以下代码段在RabbitMq中发布了消息。
var properties = channel.CreateBasicProperties();
properties.Persistent = true;
properties.DeliveryMode = (byte)deliveryMode;
properties.Timestamp = new AmqpTimestamp(Convert.ToInt64((DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds));
_logger.LogTrace("Publishing event to Queue: {EventId} with Timestamp: {Timestamp}", integrationEvent.Id, properties.Timestamp);
channel.BasicPublish(
exchange: exchangeName,
routingKey: routingKey,
mandatory: true,
basicProperties: properties,
body: body
);
channel.ConfirmSelect();
我想设置消息发布的超时时间。