[Enhancement] Replace some logic with existing APIs. Merge some logic. #3852
Closed
Description
Search before asking
- I had searched in the issues and found no similar issues.
Enhancement Request
org.apache.eventmesh.protocol.cloudevents.resolver.tcp.TcpMessageProtocolResolver:
Some logic have been implemented by existing APIs, so no need to implement them again.
Some if branches inbuildEvent(Header header, String cloudEventJson)
can be merged.
org.apache.eventmesh.protocol.meshmessage.resolver.tcpTcp.MessageProtocolResolver:
cloudEventBuilder = cloudEventBuilder.withExtension().withExtension()...
, this assignment is unecessary.
Entry is more efficient than keySet + get(key).
Describe the solution you'd like
org.apache.eventmesh.protocol.cloudevents.resolver.tcp.TcpMessageProtocolResolver:
Use existing APIs.
Merge if braches.
org.apache.eventmesh.protocol.meshmessage.resolver.tcpTcp.MessageProtocolResolver:
Use var of reference type correctly.
Use Entry to access Map.
Are you willing to submit PR?
- Yes I am willing to submit a PR!