Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Host.Plugin.Properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="Common.NuGet.Properties.xml" />

<PropertyGroup>
<Version>3.3.1-rc103</Version>
<Version>3.3.1</Version>
</PropertyGroup>

</Project>
26 changes: 18 additions & 8 deletions src/SlimMessageBus.Host.AzureEventHub/EventHubMessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
return ProviderSettings.EventHubProducerClientFactory(path);
}
catch (Exception e)

Check warning on line 46 in src/SlimMessageBus.Host.AzureEventHub/EventHubMessageBus.cs

View workflow job for this annotation

GitHub Actions / build

Either log this exception and handle it, or rethrow it with some contextual information. (https://rules.sonarsource.com/csharp/RSPEC-2139)

Check warning on line 46 in src/SlimMessageBus.Host.AzureEventHub/EventHubMessageBus.cs

View workflow job for this annotation

GitHub Actions / build

Either log this exception and handle it, or rethrow it with some contextual information. (https://rules.sonarsource.com/csharp/RSPEC-2139)
{
_logger.LogDebug(e, "Error creating EventHubClient for path {Path}", path);
throw;
Expand Down Expand Up @@ -187,21 +187,31 @@
{
inBatch.Add(item.Envelope);
advance = it.MoveNext();
if (advance)
}
else
{
// Current message doesn't fit in this batch
if (batch.Count == 0)
{
continue;
throw new ProducerMessageBusException($"Failed to add message {item.Envelope.Message} of type {item.Envelope.MessageType?.Name} on path {path} to an empty batch");
}
}

if (batch.Count == 0)
{
throw new ProducerMessageBusException($"Failed to add message {item.Envelope.Message} of type {item.Envelope.MessageType?.Name} on path {path} to an empty batch");
// Send the current batch and retry with the current message in a new batch
await producer.SendAsync(batch, cancellationToken).ConfigureAwait(false);
dispatched.AddRange(inBatch);
inBatch.Clear();

batch.Dispose();
batch = null;
// Don't advance - retry the current message in the next iteration
}
}

advance = false;
// Send any remaining messages in the final batch
if (batch != null && batch.Count > 0)
{
await producer.SendAsync(batch, cancellationToken).ConfigureAwait(false);
dispatched.AddRange(inBatch);
inBatch.Clear();

batch.Dispose();
batch = null;
Expand Down
28 changes: 19 additions & 9 deletions src/SlimMessageBus.Host.AzureServiceBus/ServiceBusMessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,22 +251,32 @@ public override async Task<ProduceToTransportBulkResult<T>> ProduceToTransportBu
{
inBatch.Add(item.Envelope);
advance = it.MoveNext();
if (advance)
}
else
{
// Current message doesn't fit in this batch
if (batch.Count == 0)
{
continue;
throw new ProducerMessageBusException($"Failed to add message {item.Envelope.Message} of Type {item.Envelope.MessageType?.Name} on Path {path} to an empty batch");
}
}

if (batch.Count == 0)
{
throw new ProducerMessageBusException($"Failed to add message {item.Envelope.Message} of Type {item.Envelope.MessageType?.Name} on Path {path} to an empty batch");
// Send the current batch and retry with the current message in a new batch
await SendBatchAsync(path, senderClient, envelopes, batch, cancellationToken).ConfigureAwait(false);
dispatched.AddRange(inBatch);
inBatch.Clear();

batch.Dispose();
batch = null;
// Don't advance - retry the current message in the next iteration
}
}

advance = false;
// Send any remaining messages in the final batch
if (batch != null && batch.Count > 0)
{
await SendBatchAsync(path, senderClient, envelopes, batch, cancellationToken).ConfigureAwait(false);
dispatched.AddRange(inBatch);
inBatch.Clear();


batch.Dispose();
batch = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Description>Core configuration interfaces of SlimMessageBus</Description>
<PackageTags>SlimMessageBus</PackageTags>
<RootNamespace>SlimMessageBus.Host</RootNamespace>
<Version>3.3.1-rc103</Version>
<Version>3.3.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading
Loading