Skip to content

Commit

Permalink
docs: added migration guide from v2 to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
joelfoliveira committed Nov 20, 2023
1 parent c9f6244 commit 01fc6f6
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions website/docs/guides/migration-guides/migrating-from-v2-to-v3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# KafkaFlow v2 to v3 Migration Guide

## Overview

KafkaFlow version 3 brings several significant changes and improvements. This guide will help you navigate through the migration process from version 2 to version 3.

## 1. Update to Target Framework to .NET 6

- The Target Framework from the library was updated from .NET 3.1 to .NET 6.

## 2. UI Dashboard URL Change

- The UI Dashboard URL has changed from `/kafka-flow` to `/kafkaflow`. Update any bookmarks or references accordingly.

## 3. Remove Packages and Core Changes

### 3.1 Removed Packages

- The following packages were removed from external dependencies and are now part of the library core:
- TypedHandler
- Compression
- Serializer
- BatchConsumer

### 3.2 Segregated Interfaces

#### ISerializer and IDeserializer Interfaces

- Consumer serialization Middleware configuration renamed from `.AddSerializer()` to `.AddDeserializer()`.
- Created `IDeserializer` interface with `.DeserializeAsync()` method.

##### ProtobufNetSerializer Changes

- Moved `.DeserializeAsync()` from `ProtobufNetSerializer` to newly created `ProtobufNetDeserializer` with `.DeserializeAsync()` method.

##### ConfluentAvroSerializer Changes

- Moved `.DeserializeAsync()` from `ConfluentAvroSerializer` to newly created `ConfluentAvroDeserializer` with `.DeserializeAsync()` method.

##### NewtonsoftJsonSerializer Changes

- Moved `.DeserializeAsync()` from `NewtonsoftJsonSerializer` to newly created `NewtonsoftJsonDeserializer` with `.DeserializeAsync()` method.

##### ConfluentJsonSerializer Changes

- Moved `.DeserializeAsync()` from `ConfluentJsonSerializer` to newly created `ConfluentJsonDeserializer` with `.DeserializeAsync()` method.

##### ConfluentProtobufSerializer Changes

- Moved `.DeserializeAsync()` from `ConfluentProtobufSerializer` to newly created `ConfluentProtobufDeserializer` with `.DeserializeAsync()` method.

#### ICompressor and IDecompressor Interfaces

- Consumer compressor middleware configuration `.AddCompressor()` renamed to `.AddDecompressor()`.
- Created `IDecompressor` interface that exposes a `.Decompress()` method.

### 3.3 Consumer Batching Configuration

- Consumer batching configuration renamed from `.BatchConsume()` to `.AddBatching()`. Update your configuration accordingly.

## 4. Async Support for Message Type Resolvers and Schema Registry Resolvers

### 4.1 ISchemaRegistryTypeNameResolver

- `ISchemaRegistryTypeNameResolver.Resolve()` renamed to `ISchemaRegistryTypeNameResolver.ResolveAsync()`. Ensure your implementation is updated to the new signature.

### 4.2 IMessageTypeResolver

- `IMessageTypeResolver.OnConsume()` renamed to `IMessageTypeResolver.OnConsumeAsync()`.
- `IMessageTypeResolver.OnProduce()` renamed to `IMessageTypeResolver.OnProduceAsync()`. Update your message type resolver implementations accordingly.

## 5. Improved Worker Distribution Strategy

- `IDistributionStrategy` interface renamed to `IWorkerDistributionStrategy`.
- `IWorkerDistributionStrategy` now receives a `WorkerDistributionStrategy` with more context to decide how to distribute to workers. Review and adjust your worker distribution strategy implementations.

## 6. Dynamic Workers Calculation Feature

### 6.1 Improved Mechanism for Signalling Message Processing Completion

- New mechanisms have been introduced to signal the completion of message processing.

### 6.2 Expose Worker Events to Client Applications

- Events related to worker activities are now exposed to client applications.

### 6.3 Dynamic Worker Pool Scaling

- A new feature allows the dynamic calculation of how many workers are needed to handle consumed messages.

### 6.4 Consumer Configuration Changes

- Added `.WithWorkersCount(Func<WorkersCountContext, IDependencyResolver, Task<int>> calculator)` to consumer configuration. Implement this method to dynamically calculate the number of workers.
- `IConsumerConfigurationBuilder.WithManualStoreOffsets` renamed to `IConsumerConfigurationBuilder.WithManualMessageCompletion`. Update your consumer configurations accordingly.

## Conclusion

Please ensure you review and adapt your codebase according to these changes. If you encounter any issues or need assistance, feel free to reach out to the KafkaFlow community. Thank you for using KafkaFlow!

0 comments on commit 01fc6f6

Please sign in to comment.