Skip to content

Multi-tenant solution with different eventStore / Database endpoints #697

Description

@trancefreak77

Hi,
We are developing a multi-tenant application by using your eventFlow framework. We plan to implement a multi-tenant feasible solution which means we want one instance of our application serve multiple customers/clients. Each customer wants to have their own/separate database server.

Do you have any input how this could be handled with eventFlow? As far as I know it is only possible to use one EventStore connection string per running instance (connection can't be switched). So all events of all different customers would end up in one EventStore instance.

Now if we need to replay events I don't see any chance to change the DBContext connection string while replaying.

I found this example how replaying could work:

public Task BootAsync(CancellationToken cancellationToken)
{
  
  var typeList = typeof(ReadModelRebuilder).Assembly.DefinedTypes.Where(type => !type.IsInterface && !type.IsAbstract && type.ImplementedInterfaces.Any(inter => inter == typeof(IReadModel))).ToList();
  typeList.ForEach(async x =>
  {
      await _populator.PurgeAsync(x, cancellationToken);
      await _populator.PopulateAsync(x, cancellationToken);
  });
  return Task.CompletedTask;
}

By using the IReadModelPopulator it is only possible to purge all readModels and then re-populate all events from the eventStore. All DB data would then end up in the currently configured database instance without the possibility to select the desired DB endpoint (per event).

Do you have any input/idea how your framework could handle such a multi-tenant setup with one running instance? Maybe switching the EventStore connectivity on the fly could help to route all events belonging to one customer to a distinct EventStore instance.

Thanks in advance,
Regards,
Christian

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions