Skip to content

Bug: Kafka dependency when multiple packages used #912

@hjgraca

Description

@hjgraca

Expected Behaviour

It should be possible to have different consumers (JSON, Avro, Protobuf) in the same project without name conflicts on same types (ConsumerRecord, ConsumerRecords)

Current Behaviour

Currently it is not possible to add different consumer without having to use the Kafka package

Code snippet

<Project> <PropertyGroup> <IncludeKafkaFiles Condition="'$(IncludeKafkaFiles)' == ''">false</IncludeKafkaFiles> </PropertyGroup> <ItemGroup Condition="'$(IncludeKafkaFiles)' == 'true' AND '$(Configuration)'=='Release'"> <PackageReference Include="Amazon.Lambda.Core"/> <PackageReference Include="AspectInjector"/> <Compile Include="..\AWS.Lambda.Powertools.Kafka\**\*.cs"> <Link>Kafka\%(RecursiveDir)%(Filename)%(Extension)</Link> </Compile> <Compile Include="..\AWS.Lambda.Powertools.Common\**\*.cs"> <Link>Common\%(RecursiveDir)%(Filename)%(Extension)</Link> </Compile> <Compile Remove="..\AWS.Lambda.Powertools.Kafka\obj\**"/> <Compile Remove="..\AWS.Lambda.Powertools.Common\obj\**"/> </ItemGroup> <!-- Auto-define compilation constants --> <PropertyGroup Condition="'$(IncludeKafkaFiles)' == 'true' AND '$(Configuration)'=='Release'"> <DefineConstants>$(DefineConstants);KAFKA_$(PackageId.Replace('AWS.Lambda.Powertools.Kafka.', '').ToUpper())</DefineConstants> </PropertyGroup> </Project>

Possible Solution

Embed all required types with namespace separation.

This will allow for

✅ Clean separation - no type conflicts
✅ centralized versioning
✅ No dependency on publishing base package

Steps to Reproduce

Import multiple consumers

Powertools for AWS Lambda (.NET) version

latest

AWS Lambda function runtime

dotnet6

Debugging logs

Metadata

Metadata

Assignees

Labels

area/kafkabugUnexpected, reproducible and unintended software behaviour

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions