sofastack / sofa-rpc

SOFARPC is a high-performance, high-extensibility, production-level Java RPC framework.
https://www.sofastack.tech/sofa-rpc/docs/Home
Apache License 2.0
3.83k stars 1.18k forks source link

bolt为什么不支持自己扩展序列化方式? #504

Closed minli04g closed 5 years ago

minli04g commented 5 years ago

Your question

describe your question clearly

Your scenes

describe your use scenes (why need this feature)

Your advice

describe the advice or solution you'd like

Environment

leizhiyuan commented 5 years ago

如果你说的是rpc的。com.alipay.sofa.rpc.codec.AbstractSerializer 实现这个抽象类就可以。

如果是直接使用了bolt,可以提给bolt的同学。

minli04g commented 5 years ago

BoltClientProxyInvoker.java 中,parseSerializeType对于其他类型序列化直接抛出异常了, 应该调用super.parseSerializeType

@Override
protected Byte parseSerializeType(String serialization) {
    Byte serializeType;
    if (SERIALIZE_HESSIAN.equals(serialization)
        || SERIALIZE_HESSIAN2.equals(serialization)) {
        serializeType = RemotingConstants.SERIALIZE_CODE_HESSIAN;
    } else if (SERIALIZE_PROTOBUF.equals(serialization)) {
        serializeType = RemotingConstants.SERIALIZE_CODE_PROTOBUF;
    } else if (SERIALIZE_JAVA.equals(serialization)) {
        serializeType = RemotingConstants.SERIALIZE_CODE_JAVA;
    } else {
        serializeType = super.parseSerializeType(serialization);
    }
    return serializeType;
}
khotyn commented 5 years ago

@dbl-x 帮忙看一下哦~

leizhiyuan commented 5 years ago

这个在群里沟通过了。@minli04g 辛苦提个mr来改一下。