gosonzhang commented on code in PR #6437:
URL: https://github.com/apache/inlong/pull/6437#discussion_r1016110260
##########
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/DefaultMessageSender.java:
##########
@@ -188,50 +189,68 @@ public String getSDKVersion() {
@Deprecated
public SendResult sendMessage(byte[] body, String attributes, String
msgUUID,
- long timeout, TimeUnit timeUnit) {
+ long timeout, TimeUnit timeUnit) {
return sender.syncSendMessage(new EncodeObject(body, attributes,
idGenerator.getNextId()), msgUUID, timeout, timeUnit);
}
public SendResult sendMessage(byte[] body, String groupId, String
streamId, long dt, String msgUUID,
- long timeout, TimeUnit timeUnit) {
+ long timeout, TimeUnit timeUnit) {
+ return sendMessage(body, groupId, streamId, dt, msgUUID, timeout,
timeUnit, false);
+ }
+
+ public SendResult sendMessage(byte[] body, String groupId, String
streamId, long dt, String msgUUID,
+ long timeout, TimeUnit timeUnit, boolean isProxySend) {
dt = ProxyUtils.covertZeroDt(dt);
if (!ProxyUtils.isBodyValid(body) || !ProxyUtils.isDtValid(dt)) {
return SendResult.INVALID_ATTRIBUTES;
}
addIndexCnt(groupId, streamId, 1);
+ String proxySend = AttributeConstants.MESSAGE_PROXY_SEND + "=false";
Review Comment:
If you don't need to enable, you don't need to carry this tag
##########
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/DefaultMessageSender.java:
##########
@@ -322,52 +360,69 @@ public SendResult sendMessage(List<byte[]> bodyList,
String groupId, String stre
@Deprecated
public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String attributes,
- String msgUUID, long timeout, TimeUnit
timeUnit) throws ProxysdkException {
+ String msgUUID, long timeout, TimeUnit timeUnit) throws
ProxysdkException {
sender.asyncSendMessage(new EncodeObject(body, attributes,
idGenerator.getNextId()),
callback, msgUUID, timeout, timeUnit);
}
- public void asyncSendMessage(SendMessageCallback callback, byte[] body,
- String groupId, String streamId, long dt,
String msgUUID,
- long timeout, TimeUnit timeUnit) throws
ProxysdkException {
+ public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String groupId, String streamId, long dt,
+ String msgUUID, long timeout, TimeUnit timeUnit) throws
ProxysdkException {
+ asyncSendMessage(callback, body, groupId, streamId, dt, msgUUID,
timeout, timeUnit, false);
+ }
+
+ public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String groupId, String streamId, long dt,
+ String msgUUID, long timeout, TimeUnit timeUnit, boolean
isProxySend) throws ProxysdkException {
dt = ProxyUtils.covertZeroDt(dt);
if (!ProxyUtils.isBodyValid(body) || !ProxyUtils.isDtValid(dt)) {
throw new
ProxysdkException(SendResult.INVALID_ATTRIBUTES.toString());
}
addIndexCnt(groupId, streamId, 1);
+ String proxySend = AttributeConstants.MESSAGE_PROXY_SEND + "=false";
+ if (isProxySend) {
+ proxySend = AttributeConstants.MESSAGE_PROXY_SEND + "=true";
+ }
boolean isCompressEnd = (isCompress && (body.length > cpsSize));
if (msgtype == 7 || msgtype == 8) {
EncodeObject encodeObject = new EncodeObject(body,
this.getMsgtype(), isCompressEnd, isReport,
isGroupIdTransfer, dt / 1000, idGenerator.getNextInt(),
- groupId, streamId, "");
+ groupId, streamId, proxySend);
encodeObject.setSupportLF(isSupportLF);
sender.asyncSendMessage(encodeObject, callback, msgUUID, timeout,
timeUnit);
} else if (msgtype == 3 || msgtype == 5) {
if (isCompressEnd) {
sender.asyncSendMessage(new EncodeObject(body, "groupId="
- + groupId + "&streamId=" + streamId + "&dt=" +
dt + "&cp=snappy",
+ + groupId + "&streamId=" + streamId + "&dt=" +
dt + "&cp=snappy" + "&" + proxySend,
Review Comment:
It is necessary to check whether the business uses the key of the reserved
function. If it is used, it will return a failure to avoid the function being
turned on by mistake.
##########
inlong-sdk/dataproxy-sdk/src/main/java/org/apache/inlong/sdk/dataproxy/DefaultMessageSender.java:
##########
@@ -322,52 +360,69 @@ public SendResult sendMessage(List<byte[]> bodyList,
String groupId, String stre
@Deprecated
public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String attributes,
- String msgUUID, long timeout, TimeUnit
timeUnit) throws ProxysdkException {
+ String msgUUID, long timeout, TimeUnit timeUnit) throws
ProxysdkException {
sender.asyncSendMessage(new EncodeObject(body, attributes,
idGenerator.getNextId()),
callback, msgUUID, timeout, timeUnit);
}
- public void asyncSendMessage(SendMessageCallback callback, byte[] body,
- String groupId, String streamId, long dt,
String msgUUID,
- long timeout, TimeUnit timeUnit) throws
ProxysdkException {
+ public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String groupId, String streamId, long dt,
+ String msgUUID, long timeout, TimeUnit timeUnit) throws
ProxysdkException {
+ asyncSendMessage(callback, body, groupId, streamId, dt, msgUUID,
timeout, timeUnit, false);
+ }
+
+ public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String groupId, String streamId, long dt,
+ String msgUUID, long timeout, TimeUnit timeUnit, boolean
isProxySend) throws ProxysdkException {
dt = ProxyUtils.covertZeroDt(dt);
if (!ProxyUtils.isBodyValid(body) || !ProxyUtils.isDtValid(dt)) {
throw new
ProxysdkException(SendResult.INVALID_ATTRIBUTES.toString());
}
addIndexCnt(groupId, streamId, 1);
+ String proxySend = AttributeConstants.MESSAGE_PROXY_SEND + "=false";
+ if (isProxySend) {
+ proxySend = AttributeConstants.MESSAGE_PROXY_SEND + "=true";
+ }
boolean isCompressEnd = (isCompress && (body.length > cpsSize));
if (msgtype == 7 || msgtype == 8) {
EncodeObject encodeObject = new EncodeObject(body,
this.getMsgtype(), isCompressEnd, isReport,
isGroupIdTransfer, dt / 1000, idGenerator.getNextInt(),
- groupId, streamId, "");
+ groupId, streamId, proxySend);
encodeObject.setSupportLF(isSupportLF);
sender.asyncSendMessage(encodeObject, callback, msgUUID, timeout,
timeUnit);
} else if (msgtype == 3 || msgtype == 5) {
if (isCompressEnd) {
sender.asyncSendMessage(new EncodeObject(body, "groupId="
- + groupId + "&streamId=" + streamId + "&dt=" +
dt + "&cp=snappy",
+ + groupId + "&streamId=" + streamId + "&dt=" +
dt + "&cp=snappy" + "&" + proxySend,
idGenerator.getNextId(), this.getMsgtype(),
true, groupId),
callback, msgUUID, timeout, timeUnit);
} else {
sender.asyncSendMessage(
new EncodeObject(body, "groupId=" + groupId +
"&streamId="
- + streamId + "&dt=" + dt,
idGenerator.getNextId(),
+ + streamId + "&dt=" + dt + "&" + proxySend,
idGenerator.getNextId(),
this.getMsgtype(), false, groupId), callback,
msgUUID, timeout, timeUnit);
}
}
}
- public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String groupId, String streamId,
- long dt, String msgUUID, long timeout,
TimeUnit timeUnit,
- Map<String, String> extraAttrMap) throws
ProxysdkException {
+ public void asyncSendMessage(SendMessageCallback callback, byte[] body,
String groupId, String streamId, long dt,
Review Comment:
It is necessary to supplement the interface description of each API,
including how to use each parameter
--
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]