java - When is messaging (e.g. JMS) an alternative for multithreading? -
I work on a data processing application, wherein several units of work on a country are given concurrency, in which many Examples are a message inspired bean (MDB). Others, in order to obtain concurrency, we have no specific reason to use messaging infrastructure and MDB.
It motivated me to think about why it could not be obtained using multiple threads.
So my question is, in what circumstances can asynchronous messaging (eg. JMS) be used as a means of conversion as an instrument for aggregation?
It can not be used as a multithreading option, to implement multithreading One way is to provide three basic types of solutions:
- You are responsible for both ends of the queue;
- You are responsible for sending data;
- You are responsible for getting the data.
The kicker is here to get the data because there really is no way to do this, without multi-threading, multi-threading / multiprocessing will process only one request at a time. Sending data is more viable, but there you are actually putting the responsibility of handling those messages in an external system. So this is not the option of multithreading.
With the messaging message you send, the container is creating and managing threads for you, so this is not the option of multithreading, you are just using someone else's implementation. / P>
Comments
Post a Comment