Closed eerhardt closed 1 month ago
cc @stbau04 @g7ed6e
Looks like the Kafta data directory is wrong. Should probably be /tmp/kraft-combined-logs (https://hub.docker.com/r/confluentinc/confluent-local) instead of /var/lib/kafka/data. This lets the test fail with another exception:
Message: Confluent.Kafka.ProduceException`2[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] : Local: Message timed out
Stack trace: Producer`2.ProduceAsync(TopicPartition topicPartition, Message`2 message, CancellationToken cancellationToken) KafkaFunctionalTests.WithDataShouldPersistStateBetweenUsages(Boolean useVolume) Zeile 127 KafkaFunctionalTests.WithDataShouldPersistStateBetweenUsages(Boolean useVolume) Zeile 135 --- End of stack trace from previous location ---
Changes are added in the draft https://github.com/dotnet/aspire/pull/4947
~Having a look there it looks like 2 volumes are required one for data and on for secrets. I need to give this a try.~
edit: It looks like a solution has been found and the folder is no longer an issue.
This is still an issue for me. Using Aspire.Hosting.Kafka version 8.2.0 on MacOS and OrbStack (Docker alternative). Tried all the WithDataVolume(), WithVolume(), WithBindMount() etc. methods and none of them result in persisted messages.
Kafka does check the the /var/lib/kafka/data for writability, but writes data to /tmp/kraft-combined-logs You can change the /tmp/kraft-combined-logs to be /var/lib/kafka/data by setting KAFKA_LOG_DIRS
This workaround solves it for me (Checked only Docker desktop so far):
var kafka = builder.AddKafka("kafka")
.WithDataVolume("ape_kafka_volume_v2")
.WithKafkaUI();
var volumeMount = kafka.Resource.Annotations.OfType<ContainerMountAnnotation>().SingleOrDefault();
if (volumeMount != null)
kafka.WithEnvironment("KAFKA_LOG_DIRS", volumeMount.Target);
Thanks @AlexanderBartoshZ and @Alirexaa !
Is there an existing issue for this?
Describe the bug
Calling WithDataVolume or WithDataBindMount on a Kafka resource doesn't persist data across runs of the application. We should ensure we have the right settings set up so the data gets persisted across app runs.
Expected Behavior
When using WithDataVolume or WithDataBindMount, the messages that are produced should be perserved across app runs. So when the app spins up again, consuming those messages should be possible.
Steps To Reproduce
Run the following test
Exceptions (if any)
.NET Version info
No response
Anything else?
No response