In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces RPC, Webservice, RMI, JMS what is the difference, the article is very detailed, has a certain reference value, interested friends must read it!
RPC (Remote Procedure Call Protocol)
RPC uses http protocol to send requests to the server and waits for the server to return the results. This request consists of a parameter set and a text set, usually in the form of "classname.methodname". The advantage is that it is cross-language and cross-platform, and the C-side and S-side are more independent. The disadvantage is that objects are not supported and errors can not be checked in the compiler, only at run time.
Web Service
The service provided by Web Service is based on web container, and the underlying layer uses http protocol, which is similar to a remote service provider, such as weather forecast service, which provides weather forecast to clients all over the country. it is a mechanism for request and response and is cross-system and cross-platform. Is to provide services through a servlet.
First, the client goes from the server to the WSDL of WebService, and claims a proxy class (Proxy Class) on the client side, which is responsible for working with WebService
The server performs Request and Response when a data (in XML format) is encapsulated into a data stream in SOAP format and sent to the server, a process object is generated and the SOAP packet received by the Request is parsed, then the transaction is processed, and the calculation result is SOAP after the processing is finished.
Wrapper, and then send the package to the client as a Response proxy class (Proxy Class). Similarly, the proxy class parses the SOAP package and then performs subsequent operations. This is a running process of WebService.
Web Service is roughly divided into five levels:
1. Http transmission channel
2. Data format of XML
3. SOAP encapsulation format
4. The description of WSDL
5. UDDI UDDI is a directory service that enterprises can use to register and search Webservices
RMI (Remote Method Invocation)
RMI uses stubs and skeletons to communicate with remote objects (remote object). Stub acts as the client proxy of the remote object and has the same remote interface as the remote object. The call of the remote object is actually accomplished by calling the client proxy object stub of the object. Through this mechanism, RMI is as if it works locally, using the tcp/ip protocol, the client directly calls some methods on the server side. The advantage is strongly typed, errors can be checked at compile time, and the disadvantage is that it can only be based on the JAVA language, and the client is tightly coupled with the server.
JMS (Java Messaging Service)
JMS is the message service of Java, and the clients of JMS can transfer messages asynchronously through JMS service. JMS supports two message models: Point-to-Point (P2P) and Publish/Subscribe (Pub/Sub), namely peer-to-peer and publish-subscribe models.
The difference and relationship between them
1. RPC and RMI
(1) RPC is cross-language, while RMI only supports Java.
(2) RMI calls remote object methods, allowing methods to return Java objects and basic data types, while RPC does not support the concept of objects. Messages sent to RPC services are represented by external data representation (External Data Representation, XDR) language, which abstracts the difference between byte order classes and data type structures. Only data types defined by XDR can be passed. RMI can be said to be an object-oriented Java RPC.
(3) in method invocation, in RMI, the remote interface makes each remote method have a method signature. If a method is executed on the server but no matching signature is added to the remote interface, the new method cannot be called by the RMI client.
In RPC, when a request arrives at the RPC server, the request contains a set of parameters and a text value, usually in the form of "classname.methodname". This indicates to the RPC server that the requested method is called "methodname" in the class that is "classname". The RPC server then searches for the matching class and method and uses it as input to that method parameter type. The parameter type here matches the type in the RPC request. Once the match is successful, the method is called, and the result is encoded and returned to the client.
2. JMS and RMI
With JMS services, objects are physically moved asynchronously from one JVM on the network to another JVM (message notification mechanism)
On the other hand, the RMI object is bound in the local JVM, and only the function parameters and return values are transmitted over the network (the request response mechanism).
RMI is generally synchronous, that is, when client calls a method of Server, it needs to wait for the other party to return before continuing to execute the client side. This process feels the same when calling local methods, which is also a feature of RMI.
JMS is usually just a click to send a Message to Message Server, after it is sent, you generally don't care who uses the message.
Therefore, the general application of RMI is tightly coupled, while the application of JMS is relatively loosely coupled.
3. Webservice and RMI
RMI is to pass serializable java objects over the tcp protocol and can only be used on java virtual machines. The binding language, client and server must be java.
Webservice does not have this restriction. Webservice transfers xml text files over the http protocol, regardless of language and platform.
4. Webservice and JMS
Webservice focuses on remote service invocation, while jms focuses on information exchange.
In most cases, Webservice is a direct interaction (Consumer Producer) between two systems, while in most cases jms is a three-party system interaction (Consumer Producer). Of course, JMS can also implement request-response mode communication, as long as one of the parties of Consumer or Producer acts as broker.
JMS can make asynchronous invocation completely separate the client and service provider, and can withstand the flood peak of traffic. WebService services are usually synchronous invocations, which require complex object conversion. Compared with SOAP, JSON,rest is now a good http architecture scheme. (for example, in the distributed system of e-commerce, there are payment systems and business systems, and the payment system is responsible for the user's payment, and the user needs to notify each business system after the bank payment, then at this time, you can use both synchronous and asynchronous, the benefits of using asynchronous can resist the temporary traffic peak of the website, or can deal with slow consumers. )
JMS is the message specification on the java platform. Generally speaking, a jms message is not a xml, but a java object. Obviously, jms does not consider heterogeneous systems. To put it bluntly, JMS does not consider non-java things. But the good news is that most jms provider (that is, various implementation products of JMS) have solved the problem of heterogeneity. It has its own advantages compared to the cross-platform of WebService.
These are all the contents of this article entitled "what's the difference between RPC, Webservice, RMI and JMS". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.