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

Outbox: A database per service is the recommended approach ? #190

Open
alefcarlos opened this issue Mar 10, 2023 · 2 comments
Open

Outbox: A database per service is the recommended approach ? #190

alefcarlos opened this issue Mar 10, 2023 · 2 comments

Comments

@alefcarlos
Copy link

I'm extending the poc with Outbox Pattern, now i'm trying to use a centralized database.

There are 2 applications, each application only knows their own messages.

When the App1 reads the Outbox table it tries to publish a message in a unknow namespace for the App1, and the following exception is thown:

[17:21:17 ERR] Error occurred processing the outbox.
System.IO.FileNotFoundException: Could not load file or assembly 'Super.App2.Api, Culture=neutral, PublicKeyToken=null'. O sistema não pode encontrar o arquivo especificado.
File name: 'Super.App2.Api, Culture=neutral, PublicKeyToken=null'
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMarkHandle stackMark, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack type, ObjectHandleOnStack keepalive)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Silverback.Util.TypesCache.ResolveType(String typeName, Boolean throwOnError)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Silverback.Util.TypesCache.GetType(String typeName, Boolean throwOnError)
   at Silverback.Messaging.Outbound.TransactionalOutbox.Repositories.DbOutboxReader.<>c.<ReadAsync>b__2_1(OutboxMessage message)
   at System.Linq.Enumerable.SelectListIterator`2.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Silverback.Messaging.Outbound.TransactionalOutbox.Repositories.DbOutboxReader.ReadAsync(Int32 count)
   at Silverback.Messaging.Outbound.TransactionalOutbox.OutboxWorker.ProcessQueueAsync(IServiceProvider serviceProvider, CancellationToken stoppingToken)
   at Silverback.Messaging.Outbound.TransactionalOutbox.OutboxWorker.ProcessQueueAsync(CancellationToken stoppingToken)

Is that the expected bahaviour ?

@alefcarlos alefcarlos changed the title Outbox: A database per service is the recommendation approach ? Outbox: A database per service is the recommended approach ? Mar 13, 2023
@BEagle1984
Copy link
Owner

It's the expected behavior but you can create a table per each service in the same database.
In the DbContext of each service you can map the DbSet<OutboxMessage> to a different table.

In the upcoming big major release, there will be more explicit and intuitive ways to do this.

@alefcarlos
Copy link
Author

alefcarlos commented Mar 17, 2023

@BEagle1984, I'm gonna try that! Thank you for your huge support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants