Comments (11)
I would avoid Transactions via decorators.
We tried this in our early days of running on Brighter, but it leads to the anti-pattern that the whole of the handler is contained within the transaction. Now, if a developer decides to do something long-running here, such as calling an HTTP endpoint, or posting a message onto RMQ, you are going to hold the transaction open for the whole time period. That is obviously a no-no.
For that reason we dropped Transactional decorators and forced developers to explicitly manage the transaction lifetime within the handler.
Our main use case for decorators is resiliency. Brighter wraps Polly and you can then run your pipeline within a Polly policy declaritively. We do this by using a Russian Doll approach to composition. EPoll is a Python library that one of the team wrote that uses a similar decorator wrapper to support resiliency model.
We also use decorators to handle fallback scenarios. Darker, our query side project for example will use it to acces a cache on fallback.
from eshoponcontainers.
Agreed. This issue is actually kind of old and we were thinking about something different instead of a transaction decorator.
The next decorator we were thinking about was a Validator decorator, maybe using FluentValidation https://github.com/JeremySkinner/FluentValidation or similar.
Resiliency might also be a good case for a decorator, although using Polly for resiliency would also be needed from the client apps. We're planning to use Polly for resiliency in the upcoming weeks, as shown in our roadmap.
It would be great to see a fork of this sample app with your implementation using Brighter, so we and the community learn from your experiences. And it would be referenced from our guidance, too. :)
from eshoponcontainers.
Will do, we have 15% time coming up next week, we'll endeavour to get a Brighter fork up and running so you can see how it would work. I can probably get a few co-conspirators to help me :-)
(PS It does also mean we can do some heavy lifting if you need some bodies. Just ask. We have thought about doing something similar to your project, but working with you guys makes more sense, so not a big ask)
from eshoponcontainers.
Sure! If you guys see code that could be improved by itself (not really related to the Brighter implementation), please do pull requests! :)
from eshoponcontainers.
@iancooper , do we have Outbox implementation in Brighton?
Sending message from Command Handler to RabbitMQ might break transactional outbox pattern
from eshoponcontainers.
@maulik-modi Brighter V9 has good Outbox support that works with RMQ publisher confirms. It's in pre-release. I think we need to get another release out in the next day or so for the publisher-confirms code. We'll go to non pre-release once our community have told us then don't have any major issues
from eshoponcontainers.
You choose an Outbox that matches the Db you use, and call DepositPost() within that transaction. You then call ClearoutBox() to flush the messages.
You can then use our OutboxSweeper to look for messages that have not been confirmed as sent within a time window and resend them (you need to run that on a thread yourself, though we are thinking about doing that for you too in a future release).
Both Kafka and RMQ callbacks for confirming a message has propagated to all the nodes are supported and will mark messages as dispatched if they confirm it was sent.
from eshoponcontainers.
There is earlier Outbox support for Brighter, but it was not so simple to use. With this release we have made it easier to use (it's effectively always on but will default to in-memory if you don't configure a persistent store, and we limit how much the in-memory box can grow)
from eshoponcontainers.
@iancooper , Please confirm https://github.com/BrighterCommand/Brighter/tree/master/src is the reository.
When I looked at TopicClientWrapper.cs in Azure Service Bus, I could see Transaction related code, I could not find similar code block in RMQ e.g. https://github.com/BrighterCommand/Brighter/blob/master/src/Paramore.Brighter.MessagingGateway.RMQ/RmqMessagePublisher.cs
public void Send(Microsoft.Azure.ServiceBus.Message message)
{
//Azure Service Bus only supports IsolationLevel.Serializable if in a transaction
if (Transaction.Current != null && Transaction.Current.IsolationLevel != IsolationLevel.Serializable)
{
using (new TransactionScope(TransactionScopeOption.Suppress))
{
_topicClient.SendAsync(message).Wait();
}
}
else
{
_topicClient.SendAsync(message).Wait();
}
}
from eshoponcontainers.
In v9 we use publisher confirms: https://www.rabbitmq.com/confirms.html
from eshoponcontainers.
That then hooks back to our Outbox support: https://github.com/BrighterCommand/Brighter/blob/master/src/Paramore.Brighter/CommandProcessor.cs (look at the ConfigurePublisherCallbackMaybe() method to start you off)
from eshoponcontainers.
Related Issues (20)
- How to deploy all Microservices Docker images to Azure Container Registry using Azure Devops Pipeline HOT 2
- Node 12 warnings HOT 2
- CORS-related errors when loading SPA version of web app HOT 1
- Explicit reference to Duende.IdentityServer.EntityFramework.Storage not required HOT 2
- [Enhancement] Add extensions methods to dynamically add and subscribe to integration event handlers
- Connection refused for AKS deployment HOT 5
- [Question] A bicep-based Azure deployment option?
- Publish new release with working version for old sdks HOT 3
- Dubious and dangerous communication pattern for checkout
- How do I deploy the entire eShopOnContainers solution to Azure? HOT 2
- [Question] Refactor of Enumeration class to avoid using Reflection for .net 8 AoT
- domainEvents no elements?
- Inject Ordering Context rather than Unit Of Work in Transaction Behavior to create Transaction in Db HOT 2
- Broken link in 'Unit and integration testing' Wiki doc
- ./quickstart.sh does not exist - deployment steps not matching MSDN documentation HOT 1
- Running from Visual Studio ends with compilation error - Node.js requiered to build and run this project. HOT 1
- Error NETSDK1045 The current .NET SDK does not support targeting .NET 7.0.
- Download PDF links are broken HOT 2
- Any reason I cannot to connect to service and container? HOT 1
- Got 404 after deployed to AKS?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eshoponcontainers.