cngfc架构
2021-09-13 20:53:14 0 举报
good 4 u
作者其他创作
大纲/内容
send()
cainiaoGlobalBigbagInformationNotifyService.font color=\"#f44336\
adaptorMap如何初始化?eventCode和adaptor什么关系?eventCode如何确定唯一的adaptor?
路由adaptor
LocalCacheRepository<V>
根据业务具体实现buildPacRequest与send方法内容
AbstractPacSendHandler
doSend(T packet): request = this.buildPacRequest(packet); font color=\"#f44336\
override
getRealExecutor(FulfillContext context)
execute方法流程定义send方法流程定义
CommonBigBagInfoNotifySendHandler
@Resource CommonNotifyAdaptorRepository commonNotifyAdaptorRepository; @Resource CainiaoGlobalBigbagInformationNotifyService cainiaoGlobalBigbagInformationNotifyService;
在具体操作点维度,构造报文的扩展字段,与业务相关。
AbstractBigBagSendActivityHandler
......
定义doSend流程
路由sendHandler为何要定义在这个纬度?
在aerConsolidationDetailNotify纬度,构造报文request基本字段,报文是 CainiaoGlobalBigbagInformationNotifyRequest
buildInteractPacket被调用
sendHanndler路由结果
获取本地缓存
PacSenderHanlder<BaseSendPacket> handler = routeSendHandler(context);packet = buildInteractPacket(context);PacSendResult sendResult = handler.doSend(packet);
LinkClient extends LinkConfigurator
SenderRouter senderRouter
SendResult sendMsg(......)this.senderRouter.route(......)
ScheduleJobImpl implements Job
@Resource private ScHandlerRepository scHandlerRepository;
深度继承
AerDomesticTransferConsolidationDetailNotifyActivityAdaptor extends AerDomesticAbstractConsolidationDetailNotifyActivityAdaptor<AerBigBagInfoNotifyPacket>
CainiaoGlobalBigbagInformationNotifyRequest buildSendRequest(AerBigBagInfoNotifyPacket packet)
buildActivityKey/new/WithoutRes
this.checkParam(context); return font color=\"#ff0000\
AerDomesticAbstractBigBagSendActivityHandler
buildInteractPacket(BigBagContext bigBagContext)
初始化
adaptor路由结果
PacSenderHanlder routeOldPacSendHandler(K context)
handler = fulfillRepository.routePacSendHandler(this.buildActivityKeyNew(context));orhandler = fulfillRepository.routePacSendHandler(this.buildActivityKey(context));orhandler = fulfillRepository.routePacSendHandler(this.buildActivityKeyWithoutRes(context));
构造用于路由activityHandler的key
调用FulfillRepository进行路由
CainiaoGlobalBigbagInformationNotifyService extends BaseSendService
SendResult<CainiaoGlobalBigbagInformationNotifyResponse> font color=\"#f44336\
PacClient
LinkClient linkClient;
public SendResult font color=\"#ff0000\
senderRouter是否用于路由报文的?
FulfillRepository
@Resource private LocalCacheRepository<HandlerCacheRepo> localCacheRepository; @Data public static class font color=\"#ff0000\
ActivityHandler routeActivityHandler(String key): HandlerCacheRepo handlerCacheRepo = localCacheRepository.getLocalCache(LocalCacheRepository.CACHE_FULFILL_HANDLER); return handlerCacheRepo.getActivityHandlerMap().get(key);routePacSendHandler(String key) routePacSendHandler(String key): HandlerCacheRepo handlerCacheRepo = localCacheRepository.getLocalCache(LocalCacheRepository.CACHE_FULFILL_. HANDLER); return handlerCacheRepo.getPacSendHandlerMap().get(key);static String buildActivityRouteKey()
构造aer大包发送维度的基本packet信息
AbstractAssembledSendActivityHandler
void execute(K context): isReturn(context) checkContext(context) ...... send(context)updateDBAndNotify(context)
CainiaoGlobalBigbagInformationNotifyRequest buildSendRequest(T packet)
routeSendHandler(context)
CommonNotifyAdaptorRepository
CommonNotifyExtInfoAdaptor routeNotifyExtInfoAdaptor(String eventCode): return font color=\"#f44336\
注入
AerDomesticTransferConsolidationDetailNotifyActivityHandler
AerBigBagInfoNotifyPacket buildInteractPacket(BigBagContext bigBagContext)
额外构造(添加)具体操作点的packet信息
BaseSendService implements InitializingBean
private PacClient pacClient;
SendResult font color=\"#ff0000\
doSend被调用
调用FulfillRepository构造key
String getEventCode(); R buildSendRequest(T packet);
根据ProductCode、TemplateCodeNodeCode、SortNum、ActivityCode,ResCode构造
String fetchRouteKey(JobContext jobContext)
if (GrayUtils.isUsingNew(context.getFlowGrayLevel())): return this::routeFlowPacSendHandler;else : return this::routeOldPacSendHandler;
ActivityHandler
void execute(A var1);
buildPacRequest()
CommonNotifyAdaptorRegistry
@Resource private CommonNotifyAdaptorRepository repository; private ApplicationContext applicationContext;
构造NotifyRequest
0 条评论
回复 删除
下一页