Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible mix & match options for message stores in the same application #1025

Open
jeremydmiller opened this issue Sep 2, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@jeremydmiller
Copy link
Member

jeremydmiller commented Sep 2, 2024

Started as "Ancillary Marten stores don't necessarily use the correct message database in inbox/outbox operations"

This is really becoming a "make Wolverine awesome for modular monoliths" by making it possible to more readily mix and match different message stores and durability agents within the same application. So:

  • Readily use separate Marten stores, but "know" how many unique message store databases there are and make sure you're always using the right one
  • Mix & match Marten & EF Core against the same postgresql database
  • Use completely separate Marten stores or EF Core DbContext in the same app pointed at different logical databases
  • Mix & match RavenDb & Postgresql & Sql Server in the same app
  • Accomodate multi-tenancy too

The envelopes are going to the correct database schema, but the DurableReceiver and durable sending agents aren't using the correct databases.

Only really an issue for local queues where messages are sent as part of a message using the ancillary store

@jeremydmiller jeremydmiller added the bug Something isn't working label Sep 2, 2024
@jeremydmiller jeremydmiller added this to the 3.0 milestone Sep 2, 2024
@jeremydmiller
Copy link
Member Author

Use this test in the code to bring out the problem:

    [Fact]
    public async Task try_to_use_the_session_transactional_middleware_end_to_end_through_a_queue()
    {
        var message = new SpawnPlayerMessage(Guid.NewGuid().ToString());
        var tracked = await theHost.InvokeMessageAndWaitAsync(message, timeoutInMilliseconds:60000);
        var envelopeId = tracked.Executed.SingleEnvelope<PlayerMessage>().Id;
    
        var store = theHost.DocumentStore<IPlayerStore>();
        using var session = store.QuerySession();
        var player = await session.LoadAsync<Player>(message.Id);
    
        player.ShouldNotBeNull();
    
        var runtime = theHost.GetRuntime();
        var messageStore = runtime.AncillaryStores.OfType<IAncillaryMessageStore<IPlayerStore>>().Single();
        var envelope = (await messageStore.Admin.AllIncomingAsync()).Single(x => x.Id == envelopeId);
        envelope.Status.ShouldBe(EnvelopeStatus.Handled);
        envelope.OwnerId.ShouldBe(TransportConstants.AnyNode);
    }

Basic issue is that the ancillary store is being more or less ignored and still using the main postgres message store. No big deal if you're all on the same database, but still.

@jeremydmiller jeremydmiller modified the milestones: 3.0, 4.0 Oct 10, 2024
@jeremydmiller jeremydmiller changed the title Ancillary Marten stores don't necessarily use the correct message database in inbox/outbox operations More flexible mix & match options for message stores in the same application Jan 10, 2025
@jeremydmiller jeremydmiller added enhancement New feature or request and removed bug Something isn't working labels Jan 10, 2025
@jeremydmiller jeremydmiller modified the milestones: 4.0, 3.7.0 Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant