Comments (6)
Thank you for your feedback, we will evaluate the question whether included in the plan.
from cap.
我们评估一下这个需不需要支持吧?
我描述一下情况: 这个就是针对于发送方在发送一条消息,消费者在消费的时候出现“业务”失败(比如库存不够),然后需要通知生产方。
目前针对于这种的处理办法是,消费者在处理业务的时候,如果库存不够需要消费者那边手动发送一条“库存不足”的消息通知生产者这边来处理接下来的业务。
这个issue的意思是:CAP在订阅那里提供一种失败回调的方法,然后在订阅的时候可以[CabSubscribe("",CallBack="")],然后碰到失败的情况时候,可以比如抛出一种 ServiceFailedException(data) 这种异常。
在实现上,针对这种这种异常情况,CAP在MQ测提供一个单独的通道,用来处理这种业务,CAP当接收到这种消息的时候,会进行路由到具体的回滚方法上。
from cap.
@yuleyule66 Xieyao.
I think this feature should be implemented in CAP.Server, not in the CAP any more.
from cap.
@alexinea 今天在看 ENode 架构图的时候突然瞄到了 Saga,我觉得可以完美解释这个 issue。
saga这个术语,可能很多人都还很陌生。saga的提出,最早是为了解决可能会长时间运行的分布式事务(long-running process)的问题。所谓long-running的分布式事务,是指那些企业业务流程,需要跨应用、跨企业来完成某个事务,甚至在事务流程中还需要有手工操作的参与,这类事务的完成时间可能以分计,以小时计,甚至可能以天计。这类事务如果按照事务的ACID的要求去设计,势必造成系统的可用性大大的降低。试想一个由两台服务器一起参与的事务,服务器A发起事务,服务器B参与事务,B的事务需要人工参与,所以处理时间可能很长。如果按照ACID的原则,要保持事务的隔离性、一致性,服务器A中发起的事务中使用到的事务资源将会被锁定,不允许其他应用访问到事务过程中的中间结果,直到整个事务被提交或者回滚。这就造成事务A中的资源被长时间锁定,系统的可用性将不可接受。
而saga,则是一种基于补偿的消息驱动的用于解决long-running process的一种解决方案。目标是为了在确保系统高可用的前提下尽量确保数据的一致性。还是上面的例子,如果用saga来实现,那就是这样的流程:服务器A的事务先执行,如果执行顺利,那么事务A就先行提交;如果提交成功,那么就开始执行事务B,如果事务B也执行顺利,则事务B也提交,整个事务就算完成。但是如果事务B执行失败,那事务B本身需要回滚,这时因为事务A已经提交,所以需要执行一个补偿操作,将已经提交的事务A执行的操作作反操作,恢复到未执行前事务A的状态。这样的基于消息驱动的实现思路,就是saga。我们可以看出,saga是牺牲了数据的强一致性,仅仅实现了最终一致性,但是提高了系统整体的可用性。
以上,引用自 http://www.cnblogs.com/netfocus/p/3149156.html
from cap.
I have added a method overloaded parameter with callbackName
in the ICapPublisher
, now you can assigned a call back subscribe name when publish a message to CAP.
The call back subscribe method will received consumer method returned value.
You can use this feature at preview version now.
from cap.
[CabSubscribe("",CallBack="")], Callback调用时机是有问题的。目前CAP我觉得只适合A -> B的场景。
想象下 A -> B -> C的时候 该怎么办呢? B给A的回调,必须要等C给B回调才能触发 , 而看CAP的代码,B方法退出时就发出了CallBack,根本没有等到C的结束。
假设C失败了,发出回滚事件能正常回滚B再回滚A吗? 我的答案是否定的
from cap.
Related Issues (20)
- Is the message data structure compatible with older versions of 3.0? HOT 1
- Add new option for parallel publish send. HOT 2
- Add option for controlling reponse headers from OnSubscribeExecuted HOT 2
- NATS Connection Error after Restarting nats-server: Unable to Publish Messages HOT 5
- SQL Server replication readpast error! "You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels" HOT 3
- 一个进程内可以创建多个CAP吗? HOT 1
- NATS feature: add the possibility to disable dynamic consumer subject/topic creation through NatsCapOtpions HOT 2
- 一个程序进程会操作多个不同的业务数据库,参考#998创建多个发布者进行对应处理,消费者应该如何处理消息? HOT 1
- Feature Request: Add New Column in table Cap.published for relation to table every single data publish HOT 2
- Callback on IIS Idle state HOT 2
- Cap-dashboard empty using dynamic subscribers with Azure Service Bus
- Feature Request:Subscribers can batch process messages HOT 1
- 现在cap支持dm8数据库吗? HOT 2
- I have already developed CAP to support the Dameng database. How can I submit it HOT 1
- Considering adding support for RocketMQ ? HOT 1
- Support for AWS Event Bridge
- Failed event may excute more than FailedRetryCount when EnableSubscriberParallelExecute is true HOT 4
- DotNetCore.CAP.Kafka consumer vulnerable to headerless messages HOT 2
- Feature request: identify and skip repeated messages HOT 1
- Feature Request: Supports publish-only or consume-only HOT 4
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 cap.