开发者

Two Java RPC Calls or One

开发者 https://www.devze.com 2023-02-08 22:46 出处:网络
I have a requirement to return two different pieces of string data through RPC calls. Would it be better to m开发者_运维技巧ake one RPC call and return a hashmap with both data points in the hashmap

I have a requirement to return two different pieces of string data through RPC calls.

Would it be better to m开发者_运维技巧ake one RPC call and return a hashmap with both data points in the hashmap or make two separate RPC calls and return a different string each time or does it matter? Is there a best practice that I should employ here?


If they're closely related, then it's best practice to return them together... either in a map like you said, or preferably in a UIVO/DTO.

If they're completely unrelated, then you should separate out your RPC methods and make two different calls.


Reducing the network IO is always good. for your simple case return a Map.

0

精彩评论

暂无评论...
验证码 换一张
取 消