masesgroup / KEFCore

Entity Framework Core provider for Apache Kafka

Home Page:https://kefcore.masesgroup.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The data are not updated when `UseCompactedReplicator` is `true`

mariomastrodicasa opened this issue · comments

Describe the bug
Enabling the usage of KNetCompactedReplicator, the test reports Sequence contains no elements when

post = context.Posts.Single(b => b.BlogId == 1009);
is executed.

To Reproduce
Steps to reproduce the behavior:

  1. Execute MASES.EntityFrameworkCore.KNet.Test.exe .\KNetReplicatorTest.json
  2. Wait the point of exception
  3. See error

Expected behavior
The code shall execute without exceptions

Screenshots
N/A

Desktop (please complete the following information):

  • Current HEAD version

Additional context
N/A

The problem comes from two different elements in the chain:

  1. The function
    public virtual IEnumerable<ValueBuffer> GetValueBuffers(IEntityType entityType)
    stores in memory the IEnumerable<ValueBuffer> associated the the IEntityType
  2. however
    public IEnumerable<ValueBuffer> ValueBuffers
    builds the IEnumerable<ValueBuffer> from latest known data when the KNetCompactedReplicator is enabled
  3. contrary, using Apache Kafka Streams the class KafkaStreamsBaseRetriever regenerate the enumerator when needed

The solution is to create an enumerator like KafkaStreamsBaseRetriever.