Revert "Merge branch 'hotfix/2.5.1' into develop"
This reverts commit 4b2ced7956
.
This commit is contained in:
parent
4b2ced7956
commit
09efa161b4
@ -9,7 +9,7 @@ namespace Tapeti.Connection
|
||||
/// <summary>
|
||||
/// Implements the bridge between the RabbitMQ Client consumer and a Tapeti Consumer
|
||||
/// </summary>
|
||||
internal class TapetiBasicConsumer : AsyncDefaultBasicConsumer
|
||||
internal class TapetiBasicConsumer : DefaultBasicConsumer
|
||||
{
|
||||
private readonly IConsumer consumer;
|
||||
private readonly Func<ulong, ConsumeResult, Task> onRespond;
|
||||
@ -24,7 +24,7 @@ namespace Tapeti.Connection
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public override async Task HandleBasicDeliver(string consumerTag,
|
||||
public override void HandleBasicDeliver(string consumerTag,
|
||||
ulong deliveryTag,
|
||||
bool redelivered,
|
||||
string exchange,
|
||||
@ -32,15 +32,18 @@ namespace Tapeti.Connection
|
||||
IBasicProperties properties,
|
||||
ReadOnlyMemory<byte> body)
|
||||
{
|
||||
try
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var response = await consumer.Consume(exchange, routingKey, new RabbitMQMessageProperties(properties), body);
|
||||
await onRespond(deliveryTag, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await onRespond(deliveryTag, ConsumeResult.Error);
|
||||
}
|
||||
try
|
||||
{
|
||||
var response = await consumer.Consume(exchange, routingKey, new RabbitMQMessageProperties(properties), body.ToArray());
|
||||
await onRespond(deliveryTag, response);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await onRespond(deliveryTag, ConsumeResult.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -656,8 +656,7 @@ namespace Tapeti.Connection
|
||||
Password = connectionParams.Password,
|
||||
AutomaticRecoveryEnabled = false,
|
||||
TopologyRecoveryEnabled = false,
|
||||
RequestedHeartbeat = TimeSpan.FromSeconds(30),
|
||||
DispatchConsumersAsync = true
|
||||
RequestedHeartbeat = TimeSpan.FromSeconds(30)
|
||||
};
|
||||
|
||||
if (connectionParams.ClientProperties != null)
|
||||
|
@ -39,12 +39,12 @@ namespace Tapeti.Connection
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<ConsumeResult> Consume(string exchange, string routingKey, IMessageProperties properties, ReadOnlyMemory<byte> body)
|
||||
public async Task<ConsumeResult> Consume(string exchange, string routingKey, IMessageProperties properties, byte[] body)
|
||||
{
|
||||
object message = null;
|
||||
try
|
||||
{
|
||||
message = messageSerializer.Deserialize(body.ToArray(), properties);
|
||||
message = messageSerializer.Deserialize(body, properties);
|
||||
if (message == null)
|
||||
throw new ArgumentException("Message body could not be deserialized into a message object", nameof(body));
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Tapeti.Config;
|
||||
|
||||
namespace Tapeti
|
||||
@ -17,6 +16,6 @@ namespace Tapeti
|
||||
/// <param name="properties">Metadata included in the message</param>
|
||||
/// <param name="body">The raw body of the message</param>
|
||||
/// <returns></returns>
|
||||
Task<ConsumeResult> Consume(string exchange, string routingKey, IMessageProperties properties, ReadOnlyMemory<byte> body);
|
||||
Task<ConsumeResult> Consume(string exchange, string routingKey, IMessageProperties properties, byte[] body);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user