Skip to content

Commit

Permalink
feat: remove unsed project refereces, fix compression interfaces names
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-sousa-8 committed Oct 9, 2023
1 parent 2a3d7b3 commit 5fcdeec
Show file tree
Hide file tree
Showing 24 changed files with 40 additions and 43 deletions.
2 changes: 0 additions & 2 deletions samples/KafkaFlow.Sample.BatchOperations/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Linq;
using KafkaFlow;
using KafkaFlow.Batching;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Producers;
using KafkaFlow.Sample.BatchOperations;
using KafkaFlow.Serializer;
Expand Down
1 change: 0 additions & 1 deletion samples/KafkaFlow.Sample.ConsumerThrottling/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ The ThrottleConsumer mechanism works by checking the lag of "consumerA" every 1
using System;
using System.Threading.Tasks;
using KafkaFlow;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Producers;
using KafkaFlow.Serializer;
using Microsoft.Extensions.DependencyInjection;
Expand Down
1 change: 0 additions & 1 deletion samples/KafkaFlow.Sample.FlowControl/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using KafkaFlow;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Sample.FlowControl;
using KafkaFlow.Serializer;
using Microsoft.Extensions.DependencyInjection;
Expand Down
1 change: 0 additions & 1 deletion samples/KafkaFlow.Sample.PauseConsumerOnError/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using KafkaFlow;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Producers;
using KafkaFlow.Sample.PauseConsumerOnError;
using KafkaFlow.Serializer;
Expand Down
1 change: 0 additions & 1 deletion samples/KafkaFlow.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Threading.Tasks;
using KafkaFlow;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Producers;
using KafkaFlow.Sample;
using KafkaFlow.Serializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace KafkaFlow
/// <summary>
/// Used to create a message compressor
/// </summary>
public interface IMessageCompressor
public interface ICompressor
{
/// <summary>
/// Compress the given message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace KafkaFlow
/// <summary>
/// Used to create a message decompressor
/// </summary>
public interface IMessageDecompressor
public interface IDecompressor
{
/// <summary>
/// Decompress the given message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using KafkaFlow.Admin;
using KafkaFlow.Admin.Handlers;
using KafkaFlow.Configuration;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Serializer;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/KafkaFlow.Compressor.Gzip/GzipMessageCompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// <summary>
/// A GZIP message compressor
/// </summary>
public class GzipMessageCompressor : IMessageCompressor
public class GzipMessageCompressor : ICompressor
{
/// <inheritdoc />
public byte[] Compress(byte[] message)
Expand Down
2 changes: 1 addition & 1 deletion src/KafkaFlow.Compressor.Gzip/GzipMessageDecompressor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// <summary>
/// A GZIP message decompressor
/// </summary>
public class GzipMessageDecompressor : IMessageDecompressor
public class GzipMessageDecompressor : IDecompressor
{
/// <inheritdoc />
public byte[] Decompress(byte[] message)
Expand Down
1 change: 0 additions & 1 deletion src/KafkaFlow.IntegrationTests/Core/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace KafkaFlow.IntegrationTests.Core
using KafkaFlow.IntegrationTests.Core.Messages;
using KafkaFlow.IntegrationTests.Core.Middlewares;
using KafkaFlow.IntegrationTests.Core.Producers;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Serializer;
using KafkaFlow.Serializer.SchemaRegistry;
using AutoOffsetReset = KafkaFlow.AutoOffsetReset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@

<ItemGroup>
<ProjectReference Include="..\KafkaFlow.Abstractions\KafkaFlow.Abstractions.csproj" />
<ProjectReference Include="..\KafkaFlow\KafkaFlow.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

<ItemGroup>
<ProjectReference Include="..\KafkaFlow.Abstractions\KafkaFlow.Abstractions.csproj" />
<ProjectReference Include="..\KafkaFlow\KafkaFlow.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@

<ItemGroup>
<ProjectReference Include="..\KafkaFlow.Abstractions\KafkaFlow.Abstractions.csproj"/>
<ProjectReference Include="..\KafkaFlow\KafkaFlow.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace KafkaFlow
{
using KafkaFlow.Configuration;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Middlewares.Serializer.Resolvers;
using KafkaFlow.Serializer.SchemaRegistry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
using Confluent.SchemaRegistry.Serdes;
using KafkaFlow.Configuration;
using KafkaFlow.Middlewares.Serializer.Configuration;
using KafkaFlow.Middlewares.Serializer.Resolvers;
using KafkaFlow.Serializer.SchemaRegistry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ namespace KafkaFlow.UnitTests.Compressors
using System;
using System.Threading.Tasks;
using FluentAssertions;

using KafkaFlow.Middlewares.Compressor;

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

[TestClass]
public class CompressorConsumerMiddlewareTests
{
private Mock<IMessageContext> contextMock;
private Mock<IMessageDecompressor> decompressorMock;
private Mock<IDecompressor> decompressorMock;
private bool nextCalled;
private DecompressorConsumerMiddleware target;

[TestInitialize]
public void Setup()
{
this.contextMock = new Mock<IMessageContext>();
this.decompressorMock = new Mock<IMessageDecompressor>();
this.decompressorMock = new Mock<IDecompressor>();
this.target = new DecompressorConsumerMiddleware(this.decompressorMock.Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ namespace KafkaFlow.UnitTests.Compressors
using System;
using System.Threading.Tasks;
using FluentAssertions;

using KafkaFlow.Middlewares.Compressor;

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

[TestClass]
public class CompressorProducerMiddlewareTests
{
private Mock<IMessageContext> contextMock;
private Mock<IMessageCompressor> compressorMock;
private Mock<ICompressor> compressorMock;

private CompressorProducerMiddleware target;

[TestInitialize]
public void Setup()
{
this.contextMock = new Mock<IMessageContext>();
this.compressorMock = new Mock<IMessageCompressor>();
this.compressorMock = new Mock<ICompressor>();

this.target = new CompressorProducerMiddleware(this.compressorMock.Object);
}
Expand Down
20 changes: 10 additions & 10 deletions src/KafkaFlow/Extensions/ConfigurationBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace KafkaFlow
using KafkaFlow.Configuration;
using KafkaFlow.Consumers;
using KafkaFlow.Consumers.WorkersBalancers;
using KafkaFlow.Middlewares.Compressor;
using KafkaFlow.Middlewares.TypedHandler;
using KafkaFlow.Middlewares.TypedHandler.Configuration;

/// <summary>
/// Provides extension methods over <see cref="IConsumerConfigurationBuilder"/> and <see cref="IProducerConfigurationBuilder"/>
Expand Down Expand Up @@ -208,7 +208,7 @@ public static IConsumerMiddlewareConfigurationBuilder AddTypedHandlers(
/// <returns></returns>
[Obsolete("Compressors should only be used in backward compatibility scenarios, in the vast majority of cases native compression (producer.WithCompression()) should be used instead")]
public static IConsumerMiddlewareConfigurationBuilder AddDecompressor<T>(this IConsumerMiddlewareConfigurationBuilder middlewares)
where T : class, IMessageDecompressor
where T : class, IDecompressor
{
middlewares.DependencyConfigurator.AddTransient<T>();
return middlewares.AddDecompressor(resolver => resolver.Resolve<T>());
Expand All @@ -218,14 +218,14 @@ public static IConsumerMiddlewareConfigurationBuilder AddDecompressor<T>(this IC
/// Registers a middleware to decompress the message
/// </summary>
/// <param name="middlewares">The middleware configuration builder</param>
/// <typeparam name="T">The compressor type that implements <see cref="IMessageCompressor"/></typeparam>
/// <param name="factory">A factory to create the <see cref="IMessageDecompressor"/> instance</param>
/// <typeparam name="T">The decompressor type that implements <see cref="IDecompressor"/></typeparam>
/// <param name="factory">A factory to create the <see cref="IDecompressor"/> instance</param>
/// <returns></returns>
[Obsolete("Compressors should only be used in backward compatibility scenarios, in the vast majority of cases native compression (producer.WithCompression()) should be used instead")]
public static IConsumerMiddlewareConfigurationBuilder AddDecompressor<T>(
this IConsumerMiddlewareConfigurationBuilder middlewares,
Factory<T> factory)
where T : class, IMessageDecompressor
where T : class, IDecompressor
{
return middlewares.Add(resolver => new DecompressorConsumerMiddleware(factory(resolver)));
}
Expand All @@ -235,11 +235,11 @@ public static IConsumerMiddlewareConfigurationBuilder AddDecompressor<T>(
/// It is highly recommended to use the producer native compression ('WithCompression()' method) instead of using the compressor middleware
/// </summary>
/// <param name="middlewares">The middleware configuration builder</param>
/// <typeparam name="T">The compressor type that implements <see cref="IMessageCompressor"/></typeparam>
/// <typeparam name="T">The compressor type that implements <see cref="ICompressor"/></typeparam>
/// <returns></returns>
[Obsolete("Compressors should only be used in backward compatibility scenarios, in the vast majority of cases native compression (producer.WithCompression()) should be used instead")]
public static IProducerMiddlewareConfigurationBuilder AddCompressor<T>(this IProducerMiddlewareConfigurationBuilder middlewares)
where T : class, IMessageCompressor
where T : class, ICompressor
{
middlewares.DependencyConfigurator.AddTransient<T>();
return middlewares.AddCompressor(resolver => resolver.Resolve<T>());
Expand All @@ -250,14 +250,14 @@ public static IProducerMiddlewareConfigurationBuilder AddCompressor<T>(this IPro
/// It is highly recommended to use the producer native compression ('WithCompression()' method) instead of using the compressor middleware
/// </summary>
/// <param name="middlewares">The middleware configuration builder</param>
/// <typeparam name="T">The compressor type that implements <see cref="IMessageCompressor"/></typeparam>
/// <param name="factory">A factory to create the <see cref="IMessageCompressor"/> instance</param>
/// <typeparam name="T">The compressor type that implements <see cref="ICompressor"/></typeparam>
/// <param name="factory">A factory to create the <see cref="ICompressor"/> instance</param>
/// <returns></returns>
[Obsolete("Compressors should only be used in backward compatibility scenarios, in the vast majority of cases native compression (producer.WithCompression()) should be used instead")]
public static IProducerMiddlewareConfigurationBuilder AddCompressor<T>(
this IProducerMiddlewareConfigurationBuilder middlewares,
Factory<T> factory)
where T : class, IMessageCompressor
where T : class, ICompressor
{
return middlewares.Add(resolver => new CompressorProducerMiddleware(factory(resolver)));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace KafkaFlow
namespace KafkaFlow.Middlewares.Compressor
{
using System;
using System.Threading.Tasks;
Expand All @@ -8,13 +8,13 @@
/// </summary>
public class CompressorProducerMiddleware : IMessageMiddleware
{
private readonly IMessageCompressor compressor;
private readonly ICompressor compressor;

/// <summary>
/// Initializes a new instance of the <see cref="CompressorProducerMiddleware"/> class.
/// </summary>
/// <param name="compressor">Instance of <see cref="IMessageCompressor"/></param>
public CompressorProducerMiddleware(IMessageCompressor compressor)
/// <param name="compressor">Instance of <see cref="ICompressor"/></param>
public CompressorProducerMiddleware(ICompressor compressor)
{
this.compressor = compressor;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace KafkaFlow
namespace KafkaFlow.Middlewares.Compressor
{
using System;
using System.Threading.Tasks;
Expand All @@ -8,13 +8,13 @@
/// </summary>
public class DecompressorConsumerMiddleware : IMessageMiddleware
{
private readonly IMessageDecompressor decompressor;
private readonly IDecompressor decompressor;

/// <summary>
/// Initializes a new instance of the <see cref="CompressorConsumerMiddleware"/> class.
/// Initializes a new instance of the <see cref="DecompressorConsumerMiddleware"/> class.
/// </summary>
/// <param name="decompressor">Instance of <see cref="IMessageDecompressor"/></param>
public DecompressorConsumerMiddleware(IMessageDecompressor decompressor)
/// <param name="decompressor">Instance of <see cref="IDecompressor"/></param>
public DecompressorConsumerMiddleware(IDecompressor decompressor)
{
this.decompressor = decompressor;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace KafkaFlow.Middlewares.Serializer.Configuration
namespace KafkaFlow
{
using System;
using KafkaFlow.Configuration;
using KafkaFlow.Middlewares.Serializer;
using KafkaFlow.Middlewares.Serializer.Resolvers;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace KafkaFlow.Middlewares.Serializer.Configuration
namespace KafkaFlow
{
using System;
using KafkaFlow.Configuration;
using KafkaFlow.Middlewares.Serializer;
using KafkaFlow.Middlewares.Serializer.Resolvers;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace KafkaFlow.Middlewares.TypedHandler.Configuration
namespace KafkaFlow
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

using KafkaFlow.Middlewares.TypedHandler.Configuration;

/// <summary>
/// Builder class for typed handler configuration
/// </summary>
Expand Down

0 comments on commit 5fcdeec

Please sign in to comment.