Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is seata protocol?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the seata protocol". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the seata protocol".

Code entry

Io.seata.core.rpc.netty.NettyClientBootstrap#start

Bootstrap.handler (new ChannelInitializer () {@ Override public void initChannel (SocketChannel ch) {ChannelPipeline pipeline = ch.pipeline () Pipeline.addLast (new IdleStateHandler (nettyClientConfig.getChannelMaxReadIdleSeconds (), nettyClientConfig.getChannelMaxWriteIdleSeconds (), nettyClientConfig.getChannelMaxAllIdleSeconds () .addLast (new ProtocolV1Decoder ()) .addLast (new ProtocolV1Encoder ()) If (channelHandlers! = null) {addChannelPipelineLast (ch, channelHandlers);})

Io.seata.core.rpc.netty.v1.ProtocolV1Encoder#encode

Io.seata.core.protocol.RpcMessage

Protocol rules

2-byte modulus ([- 38 key 38]) | version number of 1 byte | length of 6 bytes | messageType of 1 byte | Codec value of 1 byte | compressor of 1 byte | messagID value of 4 bytes | header data value (2 bytes of key length | value data value) | Business data value

Codec: serialization type: such as seata,kryo;protobuf;fst

Compressor: compression type: such as NONE, GZIP,BZIP2,LZ4

A length of 6 bytes:

4 bytes (length of all data): default length 16+headLength+bodyLength

2 bytes (headLength) with a default length of 16

Business data serialization

Io.seata.serializer.seata.SeataSerializer#serialize

2 bytes (value of typecode) | body

Typecode: message type encoders such as (RegisterTMRequestCodec,BranchRollbackRequestCodec)

Body:

2 bytes (length of xid) | xid data | 8 bytes (branchId value) | one byte (branch transaction type normal value) | 2 bytes (length of ResourceId) | value of ResourceId | 4 bytes (length of applicationData) | value of applicationData |

Transaction type: AT,TCC,XA,SAGA

Thank you for your reading, the above is the content of "what is the seata protocol", after the study of this article, I believe you have a deeper understanding of what is the seata protocol, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report