Java – when to select JMS API through UDP socket API and vice versa?

It can motivate programmers to use the Java JMS (Java Message Service) API instead of Java in distributed Java applications Net package, or use UDP socket API instead of JMS API? If possible, please provide a sample application

Solution

UDP and JMS are different in many ways. Fundamentally, JMS usually depends on the inherent functions of TCP (see the comparison of UDP and TCP to understand the difference between the two underlying protocols)

Basically, UDP is suitable for applications that do not require any reliability, sorting, congestion control or inter network routing (because many consumer and commercial routers do not forward UDP packets) JMS provides all these functions missing from UDP and more (such as transaction, pub / sub and queuing, persistent subscription, etc.)

UDP may be suitable for streaming a large amount of data in a LAN that does not require absolute quality; JMS is better for applications that require reliable messaging between Wan hosts In addition, JMS also covers up the details of sockets, servers, bindings, etc., and provides advanced APIs more suitable for enterprise integration

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>