config(gb32960): add parse.lenientBlockFailure toggle

新增 lingniu.ingest.gb32960.parse.lenientBlockFailure 配置开关(默认 true),
为 Gb32960BodyParser 的单块异常隔离行为做回退开关。实现在后续 commit。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-20 15:12:16 +08:00
parent d8279ac3b7
commit fa552f4b20

View File

@@ -26,6 +26,16 @@ public class Gb32960Properties {
/** TLS 双向认证。 */
private Tls tls = new Tls();
/**
* 报文解析行为配置。
*
* <p>默认 {@code lenientBlockFailure=true}:单个信息块解析异常时兜成
* {@link com.lingniu.ingest.protocol.gb32960.model.InfoBlock.Raw} 继续解析,
* 不再整帧放弃。关闭后恢复旧行为(任意异常直接抛 {@code DecodeException}
* 放弃整帧),仅在灰度回滚时使用。
*/
private Parse parse = new Parse();
/**
* 厂商扩展协议vendor extensions路由配置。
*
@@ -54,6 +64,8 @@ public class Gb32960Properties {
public void setAuth(Auth auth) { this.auth = auth; }
public Tls getTls() { return tls; }
public void setTls(Tls tls) { this.tls = tls; }
public Parse getParse() { return parse; }
public void setParse(Parse parse) { this.parse = parse; }
public List<VendorExtension> getVendorExtensions() { return vendorExtensions; }
public void setVendorExtensions(List<VendorExtension> vendorExtensions) {
this.vendorExtensions = vendorExtensions;
@@ -164,6 +176,29 @@ public class Gb32960Properties {
public void setRequireClientAuth(boolean requireClientAuth) { this.requireClientAuth = requireClientAuth; }
}
/**
* 报文解析容错策略。
*/
public static class Parse {
/**
* 单块解析异常时是否兜底为 {@link com.lingniu.ingest.protocol.gb32960.model.InfoBlock.Raw}
* 继续解析。默认开启。
*
* <ul>
* <li>{@code true}默认parser 抛 DecodeException / BufferUnderflowException /
* IndexOutOfBoundsException 时,固定长度块按 fixedLen 截取 Raw 后 continue
* 变长块或剩余字节不足时,剩余全部兜成 Raw 后 break 循环。
* <li>{@code false}:保留旧行为,任意异常直接抛出 DecodeException 放弃整帧。
* </ul>
*/
private boolean lenientBlockFailure = true;
public boolean isLenientBlockFailure() { return lenientBlockFailure; }
public void setLenientBlockFailure(boolean lenientBlockFailure) {
this.lenientBlockFailure = lenientBlockFailure;
}
}
/**
* 单条 vendor 扩展路由配置。{@code name} 必须与
* {@code VendorExtensionCatalog} 注册的 key 一致。