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

When do you need to use messaging or RMI/IIOP in an EJB2.0 system

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

The editor will share with you when you need to use messaging or RMI/IIOP in the EJB2.0 system. I hope you will get something after reading this article. Let's discuss it together.

When to use messaging or Rmi/IIOP in EJB2.0 system

Here are the advantages of messaging and why you need to use it:

1. Database performance. If you do a relational database job, such as

It is more advantageous to use messaging to persist an order to a database.

Sending a message to a secondary message queue was mitigated by later processing

The pressure of the main database during the rush hour. In the morning with a low load in the morning, when

When the traffic is small, you can take out and process that message in the message queue.

And insert the order into the database Note that this is only before the user, no matter what the fuck.

It works when you don't need an immediate answer, such as testing his credit card.

two。 Quick reaction. A customer may not want to be blocked and wait for a non-existent

Reflect. For methods that return a value of void, it is only possible to return nothing or a

Abnormal. If the customer does not expect to receive an exception, why does it have to be blocked?

Did Cy get a reaction? Messaging allows the client to deal with other things when he is

Blocking gets the return of a method.

3. Smooth load balancing. Message-driven beans is better than session and entity

Bean distributes the load more smoothly. With session and entity bean, a load

The balancing algorithm cleverly guesses which server has less load. Use messaging, load

The smallest server requests message to get that message.

4. Request first. Asynchronous servers can queue columns, set priorities, and use with meaasge

Reach the system in a different order to deal with them. There are some messaging systems that allow messages to follow the

Business rules are prioritized to be sorted. For example, in a military tank

If all requests to the system are sent to the centralized distribution queue to be asynchronous

Then the order to fire can lead to disaster after 100 communication messages. In the military

In the system, it is more advantageous to deal with fire control and security messages before communication messages.

A queue with priority set allows messages in the queue to be rearranged to calculate the tank.

The urgency of fire control.

5. A fast collection and separation system. Many existing systems are built on message-oriented

And you can easily use messaging to interact with your J2EE system.

Messaging provides a distributed node system for commercial processing and must communicate with each other.

Rapid development environment.

6. Loosely coupled system. Messaging enables loose coupling between applications. Application program

They don't need to know each other when they are compiled. This allows you to have "dynamic discovery" applications

Can be useful in a rapidly changing, service-oriented business environment

7. Parallel processing. Messaging is a way to use pseudo-threads in EJB publishing.

You can start a series of messages and continue processing, just like distributed startup of many threads.

8. Reliability. Messaging is used even if the server is pawned. System-level errors such as

The database is pawned) usually does not affect the success of the operation because the message is still in the queue

Until system-level errors are resolved.

9. Many-to-many communication. If you have many groups working together to communicate with each other, messaging is

Appropriate, because it enables many producers and consumers to collaborate with each other, while RMI/IIOP

Is a single-source and single-purpose request model.

Here are some situations where you should not use messaging:

1. When you are not sure whether the operation is successful. The RMI/IIOP system can throw an exception, while

Not message-driven bean.

two。 When you need to return the results. The RMI/IIOP system can return the results immediately because

The request was executed immediately. Instead, you can finally return the result through messaging

But it's frustrating: you need to send a delimited return message and use the initial

Clients to monitor them.

3. When your operation is part of a larger transaction. When you go to your destination

Send a message and the received message-driven bean cannot handle anything else.

Message until a future transaction. This is a separate operation for what you need.

Atomic, it is not appropriate to deal with part of a transaction of other operations.

For example, when you operate a bank account transfer, use RMI/IIOP

It's a bad idea to deposit money in a bank account, and so is using messaging to withdraw money.

Because withdrawing money may fail.

4. When you need to pass the customer's secure ID to the server. Because messaging doesn't put

You can't easily transfer the customer's secure ID to the receiving message-driven bean.

Ensure the security of your business operations.

5. When you care about request performance. Messaging is inherently slower than RMI/IIOP because

There is a JMS between the sender and the receiver.

6. When you need a strongly typed, OO system. By using messaging api,

Such as JMS to send messages. This is a smooth API and not a face object.

When you want to complete different operations, the server needs a message opened by crack, or

Filter it out. By contrast, RMI/IIOP allows you to base your business operations on what you want to do.

To invoke different business methods. This is more intuitive; it's also easier to do compile-time

Semantic check.

7. When you need a tighter, more direct system. Synchronous release ratio messaging

More direct. You have great freedom when to send data types, and you need to write

The least amount of code compared to messaging Debugging is also more straightforward. When using

A fully synchronized service in which each client control thread has a separate service that can be followed

The path from the client to the server, and vice versa. When the system has bug

The effort to track them is also minimal.

After reading this article, I believe you have a certain understanding of "when you need to use messaging or RMI/IIOP in the EJB2.0 system". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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

Development

Wechat

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

12
Report