Skip to content

Commit

Permalink
[ISSUE #442] Fix findings filtered by Checkstyle workflow (#443)
Browse files Browse the repository at this point in the history
* fix findings in RequestCode

* fix findings in ClientRetCode

* fix findings in Async*

* fix findings in eventmesh-runtime

* translate all chinese

* translate

* fix findings in org.apache.eventmesh.spi.example

* move package demo to org.apache.eventmesh.runtime.demo

* translate

* rename package client to org.apache.eventmesh.runtime.client

* rename package client to org.apache.eventmesh.runtime.client

* update checkStyle.xml

* fix System.err.out

* delete sChat2

* remove comments in eventmesh-sdk-java:build.gradle

* remove Chinese in eventmesh-test:build.gradle

* fix Chinese findings in tcp_sub_broadcast.sh

* fix Chinese findings in *.sh
  • Loading branch information
SteveYurongSu authored Jul 19, 2021
1 parent e89bfd9 commit db42296
Show file tree
Hide file tree
Showing 62 changed files with 275 additions and 260 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
public enum ClientRetCode {

/**
* The "RETRY" means:when the client finds the delivered message and it does not listen, tell EventMesh to send next,try again several times to achieve grayscale, reserve
* The "RETRY" means:when the client finds the delivered message and it does not listen, tell EventMesh to send
* next, try again several times to achieve grayscale, reserve
*/

OK(1, "ok, SDK返回"),
RETRY(2, "retry, SDK返回, 这种情况需要尝试至多 max(default, config)"),
FAIL(3, "fail, SDK返回"),
NOLISTEN(5, "没有监听, SDK返回, 可用于灰度发布实现, 这种情况需要尝试完所有的url");
OK(1, "OK. SDK returns."),
RETRY(2, "RETRY. SDK returns. Retry at most max(default, config) times."),
FAIL(3, "FAIL. SDK returns."),
NOLISTEN(5, "NOLISTEN. SDK returns. It can be used for grayscale publishing. Need to try all URLs in this case.");

ClientRetCode(Integer retCode, String errMsg) {
this.retCode = retCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

public enum ClientType {

PUB(1, "发送客户端"),
PUB(1, "Client for publishing"),

SUB(2, "监听客户端");
SUB(2, "Client for subscribing");

private Integer type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@

public enum RequestCode {

MSG_BATCH_SEND(102, "批量发送"),
MSG_BATCH_SEND(102, "SEND BATCH MSG"),

MSG_BATCH_SEND_V2(107, "批量发送V2"),
MSG_BATCH_SEND_V2(107, "SEND BATCH MSG V2"),

MSG_SEND_SYNC(101, "单条发送同步消息"),
MSG_SEND_SYNC(101, "SEND SINGLE MSG SYNC"),

MSG_SEND_ASYNC(104, "单条发送异步消息"),
MSG_SEND_ASYNC(104, "SEND SINGLE MSG ASYNC"),

HTTP_PUSH_CLIENT_ASYNC(105, "PUSH CLIENT BY HTTP POST"),

HTTP_PUSH_CLIENT_SYNC(106, "PUSH CLIENT BY HTTP POST"),

REGISTER(201, "注册"),
REGISTER(201, "REGISTER"),

UNREGISTER(202, "去注册"),
UNREGISTER(202, "UNREGISTER"),

HEARTBEAT(203, "心跳, 发送方与消费方分别心跳, 类型区分"),
HEARTBEAT(203, "HEARTBEAT"),

SUBSCRIBE(206, "订阅"),
SUBSCRIBE(206, "SUBSCRIBE"),

UNSUBSCRIBE(207, "去订阅"),
UNSUBSCRIBE(207, "UNSUBSCRIBE"),

REPLY_MESSAGE(301, "发送返回消息"),
REPLY_MESSAGE(301, "REPLY MESSAGE"),

ADMIN_METRICS(603, "管理接口, METRICS信息"),
ADMIN_METRICS(603, "ADMIN METRICS"),

ADMIN_SHUTDOWN(601, "管理接口, SHUTDOWN");
ADMIN_SHUTDOWN(601, "ADMIN SHUTDOWN");

private Integer requestCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ConsumerGroupTopicConf {
/**
* PUSH URL
*/
private Map<String /** IDC*/, List<String> /** IDC内URL列表*/> idcUrls = Maps.newConcurrentMap();
private Map<String /** IDC */, List<String> /** URL list in IDC */> idcUrls = Maps.newConcurrentMap();

/**
* ALL IDC URLs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>

if (eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshServerBatchMsgBatchEnabled) {
for (List<Message> batchMsgs : topicBatchMessageMappings.values()) {
// TODO:api中的实现,考虑是否放到插件中
// TODO: Implementation in API. Consider whether to put it in the plug-in.
Message omsMsg = new Message();
// try {
// msgBatch = msgBatch.generateFromList(batchMsgs);
// for (Message message : msgBatch.getMessages()) {
// // TODO:未针对不同producer检测消息最大长度
// // TODO: Detect the maximum length of messages for different producers.
// Validators.checkMessage(message, batchEventMeshProducer.getMqProducerWrapper().getDefaultMQProducer());
// MessageClientIDSetter.setUniqID(message);
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public void trySendListenResponse(Header header, long startTime, long taskExecut
Package msg = new Package();
msg.setHeader(header);

//TODO startTime 修改了
// TODO: if startTime is modified
Utils.writeAndFlush(msg, startTime, taskExecuteTime, context, this);
listenRspSend = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private void retryHandle(DownStreamMsgContext downStreamMsgContext) {
// if(EventMeshTCPServer.getAccessConfiguration().eventMeshTcpSendBackEnabled){
// sendMsgBackToBroker(finalDownStreamMsgContext.msgExt, bizSeqNo, uniqueId);
// }else{
// //TODO 将消息推给其它eventMesh,待定
// // TODO: Push the message to other EventMesh instances. To be determined.
// sendMsgToOtherEventMesh(finalDownStreamMsgContext.msgExt, bizSeqNo, uniqueId);
// }
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private RRCallback initSyncRRCallback(Header header, long startTime, long taskEx
@Override
public void onSuccess(Message msg) {
String seq = header.getSeq();
//TODO 此处如何赋值
// TODO: How to assign values here
// if (msg instanceof MessageExt) {
// msg.putUserProperty(EventMeshConstants.BORN_TIMESTAMP, String.valueOf(((MessageExt) msg)
// .getBornTimestamp()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public float avgHTTPBodyDecodeCost() {

private AtomicLong sendBatchMsgFailNumSum = new AtomicLong(0);

//累计值
// This is a cumulative value
private AtomicLong sendBatchMsgDiscardNumSum = new AtomicLong(0);

public void recordSendBatchMsgDiscard(long delta) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package client;
package org.apache.eventmesh.runtime.client.api;

import org.apache.eventmesh.common.protocol.SubcriptionType;
import org.apache.eventmesh.common.protocol.tcp.Package;

import client.hook.ReceiveMsgHook;
import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;
import org.apache.eventmesh.common.protocol.SubscriptionMode;

public interface EventMeshClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package client;
package org.apache.eventmesh.runtime.client.api;

import org.apache.eventmesh.common.protocol.tcp.Package;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;

import client.hook.ReceiveMsgHook;
import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;


public interface PubClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package client;
package org.apache.eventmesh.runtime.client.api;

import org.apache.eventmesh.common.protocol.SubcriptionType;
import org.apache.eventmesh.common.protocol.tcp.Package;
import org.apache.eventmesh.common.protocol.SubscriptionMode;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;

import client.hook.ReceiveMsgHook;
import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;


public interface SubClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;


public interface ClientConstants {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import java.util.TimeZone;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import java.nio.charset.Charset;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import java.util.concurrent.CountDownLatch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import org.apache.eventmesh.runtime.boot.EventMeshServer;
import org.apache.eventmesh.runtime.configuration.EventMeshHTTPConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import java.io.Closeable;
import java.net.InetSocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.common;
package org.apache.eventmesh.runtime.client.common;

import java.util.concurrent.ThreadLocalRandom;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.hook;
package org.apache.eventmesh.runtime.client.hook;

import io.netty.channel.ChannelHandlerContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
* limitations under the License.
*/

package client.impl;
package org.apache.eventmesh.runtime.client.impl;

import org.apache.eventmesh.common.protocol.SubcriptionType;
import org.apache.eventmesh.common.protocol.tcp.Package;
import org.apache.eventmesh.common.protocol.SubscriptionMode;
import org.apache.eventmesh.common.protocol.tcp.UserAgent;

import client.EventMeshClient;
import client.PubClient;
import client.SubClient;
import client.common.UserAgentUtils;
import client.hook.ReceiveMsgHook;
import org.apache.eventmesh.runtime.client.api.EventMeshClient;
import org.apache.eventmesh.runtime.client.api.PubClient;
import org.apache.eventmesh.runtime.client.api.SubClient;
import org.apache.eventmesh.runtime.client.common.UserAgentUtils;
import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;

public class EventMeshClientImpl implements EventMeshClient {
protected UserAgent agent;
Expand Down Expand Up @@ -78,22 +78,22 @@ public void heartbeat() throws Exception {
this.subClient.heartbeat();
}


public Package listen() throws Exception {
return this.subClient.listen();
}

@Override
public Package justSubscribe(String topic, SubscriptionMode subscriptionMode, SubcriptionType subcriptionType) throws Exception {
public Package justSubscribe(String topic, SubscriptionMode subscriptionMode,
SubcriptionType subcriptionType) throws Exception {
return this.subClient.justSubscribe(topic, subscriptionMode, subcriptionType);
}

@Override
public Package justUnsubscribe(String topic, SubscriptionMode subscriptionMode, SubcriptionType subcriptionType) throws Exception {
public Package justUnsubscribe(String topic, SubscriptionMode subscriptionMode,
SubcriptionType subcriptionType) throws Exception {
return this.subClient.justUnsubscribe(topic, subscriptionMode, subcriptionType);
}


public void registerSubBusiHandler(ReceiveMsgHook handler) throws Exception {
this.subClient.registerBusiHandler(handler);
}
Expand All @@ -105,10 +105,10 @@ public void registerPubBusiHandler(ReceiveMsgHook handler) throws Exception {
@Override
public String toString() {
return "AccessClientImpl{" +
"accessHost='" + accessHost + '\'' +
", accessPort=" + accessPort +
", agent=" + agent +
'}';
"accessHost='" + accessHost + '\'' +
", accessPort=" + accessPort +
", agent=" + agent +
'}';
}

@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package client.impl;
package org.apache.eventmesh.runtime.client.impl;

import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand All @@ -32,12 +32,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import client.PubClient;
import client.common.ClientConstants;
import client.common.MessageUtils;
import client.common.RequestContext;
import client.common.TCPClient;
import client.hook.ReceiveMsgHook;
import org.apache.eventmesh.runtime.client.api.PubClient;
import org.apache.eventmesh.runtime.client.common.ClientConstants;
import org.apache.eventmesh.runtime.client.common.MessageUtils;
import org.apache.eventmesh.runtime.client.common.RequestContext;
import org.apache.eventmesh.runtime.client.common.TCPClient;
import org.apache.eventmesh.runtime.client.hook.ReceiveMsgHook;

public class PubClientImpl extends TCPClient implements PubClient {

Expand Down Expand Up @@ -202,7 +202,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Package msg) throws Excep
return;
}
} else if (cmd == Command.SERVER_GOODBYE_REQUEST) {
System.err.println("server goodby request: ---------------------------" + msg.toString());
publogger.error("server goodby request: ---------------------------" + msg.toString());
close();
} else {
RequestContext context = contexts.get(RequestContext._key(msg));
Expand Down
Loading

0 comments on commit db42296

Please sign in to comment.