mytang0 commented on code in PR #1037:
URL:
https://github.com/apache/incubator-eventmesh/pull/1037#discussion_r931934453
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java:
##########
@@ -92,21 +92,26 @@ public void retry() {
Command replyCmd = getReplyCmd(header.getCmd());
long sendTime = System.currentTimeMillis();
- EventMeshTcpSendResult sendStatus = session.upstreamMsg(header,
event,
- createSendCallback(replyCmd, taskExecuteTime, event),
startTime, taskExecuteTime);
+ retryTimes++;
- if (StringUtils.equals(EventMeshTcpSendStatus.SUCCESS.name(),
sendStatus.getSendStatus().name())) {
-
logger.info("pkg|eventMesh2mq|cmd={}|event={}|user={}|wait={}ms|cost={}ms",
header.getCmd(), event,
+ // check session availability
+ if (session.isAvailable(event.getSubject())) {
Review Comment:
> session.isAvailable() is not suitable for use hereļ¼this method was
originally used to determine whether a message can be sent to a consumer
session. The method contains logic as follows:
>
> ```
> if (!sessionContext.subscribeTopics.containsKey(topic)) {
> logger.warn("session is not available because session has not
subscribe topic:{},client:{}", topic, client);
> return false;
> }
> ```
If so, then isAvailable needs to be more refined. This modification is
because the session has been closed, the retry logic is still calling
session.upstreamMsg, an unnecessary exception occurs, and even an infinite loop.
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/session/send/UpStreamMsgContext.java:
##########
@@ -92,21 +92,26 @@ public void retry() {
Command replyCmd = getReplyCmd(header.getCmd());
long sendTime = System.currentTimeMillis();
- EventMeshTcpSendResult sendStatus = session.upstreamMsg(header,
event,
- createSendCallback(replyCmd, taskExecuteTime, event),
startTime, taskExecuteTime);
+ retryTimes++;
- if (StringUtils.equals(EventMeshTcpSendStatus.SUCCESS.name(),
sendStatus.getSendStatus().name())) {
-
logger.info("pkg|eventMesh2mq|cmd={}|event={}|user={}|wait={}ms|cost={}ms",
header.getCmd(), event,
+ // check session availability
+ if (session.isAvailable(event.getSubject())) {
Review Comment:
> If so, then isAvailable needs to be more refined. This modification is
because the session has been closed, the retry logic is still calling
session.upstreamMsg, an unnecessary exception occurs, and even an infinite loop.
If so, then isAvailable needs to be more refined. This modification is
because the session has been closed, the retry logic is still calling
session.upstreamMsg, an unnecessary exception occurs, and even an infinite loop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]