A distribute transaction solution(分布式事务) unified the usage of TCC , SAGA ,FMT (seata/fescar AutoCompensation), reliable message, compensate and so on;
2.36k
stars
809
forks
source link
EasyTransMsgInitializer 消息消费,如果业务代码抛异常,框架代码空指针问题 #139
Closed
andres818 closed 4 years ago
Describe the bug EasyTransMsgInitializer类中, 消息消费,如果业务代码抛异常(如下代码),在catch中捕获后,return easyTransResult 中的setValue方法未设值则为空,
private void wrapToFilter(final BusinessProvider<?> handler) {
在这个代码中, @Override public EasyTransConsumeAction consume(Map<String,Object> header, EasyTransRequest<?, ?> message) {
// EasyTransFilterChain filterChain = filterChainFactory.getDefaultFilterChain(applicationName/should use consumer's appId/, businessIdentifer.busCode(), EasyTransFilterChain.MESSAGE_BUSINESS_FLAG); EasyTransFilterChain filterChain = filterChainFactory.getDefaultFilterChain(businessIdentifer.appId(), businessIdentifer.busCode(), EasyTransFilterChain.MESSAGE_BUSINESS_FLAG); filterChain.addFilter(consumeStatusCheckFilter); filterChain.addFilter(easyTransFilter); EasyTransResult result = filterChain.invokeFilterChain(header,message);
设值result.setValue(EasyTransConsumeAction.ReconsumeLater); 最终返回值consumeResult还是为空 EasyTransConsumeAction consumeResult = (EasyTransConsumeAction) result.getValue(); if(consumeResult == null){ result.setValue(EasyTransConsumeAction.ReconsumeLater); }
则在OnsEasyTransMsgConsumerImpl类中,Action.valueOf(consume.name());空指针异常consume为null @Override public void subscribe(String topic, Collection tag,
final EasyTransMsgListener listener) {
// int messageLen = Integer.parseInt(userProperties.get(OnsEasyTransMsgPublisherImpl.MESSAGE_LEN).toString()); byte[] combined = message.getBody(); byte[] headerBytes = Arrays.copyOfRange(combined, 0, headerLen); byte[] messageBytes = Arrays.copyOfRange(combined, headerLen, combined.length);