Introduction to MQ:
MQ is all called the message queue, and Message Queuing (MQ) is an application-to-application communication method. Applications communicate by writing and retrieving data (messages) for applications that enter and leave the queue, without requiring a private connection to link them. Message passing refers to the process of communicating between programs by sending data in a message, rather than by directly invoking each other, and directly invoking techniques such as remote procedure calls. Queuing refers to an application communicating through a queue. The use of queues removes the requirement that both the receiving and sending applications execute concurrently. One of the more mature MQ products is Ibmwebsphere MQ.
MQ Features:
A typical representation of MQ's consumption-producer model, where one end writes messages continuously to the message queue, while the other end reads or subscribes to messages in the queue. MQ is similar to JMS, but the difference is that JMS is a standard and API definition for the Sun Java Messaging Middleware Service, and MQ follows the specific implementations and products of the AMQP protocol.
Usage Scenarios:
In the project, some operations without immediate return and time-consuming are extracted and processed asynchronously, which greatly saves the request response time of the server and improves the throughput of the system.
JMS and MQ relationships:
JMS is a technical specification for providing a messaging service that develops all the data structures and interaction processes throughout the messaging service delivery process. MQ, the Message Queuing service, is the ultimate implementation of message-oriented middleware (MOM), a true service provider, and the implementation of MQ can be based on JMS or other specifications or standards.
Open source MQ with JMS support:
The most currently selected is ActiveMQ.
ActiveMQ is the most popular, powerful, open source messaging bus that Apache has produced. ActiveMQ is a JMS provider implementation that fully supports the JMS1.1 and the Java EE 1.4 specification, although the JMS specification has been around for a long time, but JMS still plays a special role in the middle of today's Java EE applications.
Main Features:
1. Write clients in multiple languages and protocols. Languages: Java, C, C + +, C #, Ruby, Perl, Python, PHP. Application protocol: Openwire,stomp REST,WSNOTIFICATION,XMPP,AMQP
2. Full support for JMS1.1 and the Java EE 1.4 specification (persistence, XA messages, transactions)
3. Support for spring, ACTIVEMQ can easily be embedded into the system using spring, but also support the features of Spring2.0
4. Tested by common Java EE servers (such as Geronimo,jboss 4, glassfish,weblogic), with the configuration of the JCA 1.5 resource adaptors, Allows ACTIVEMQ to automatically deploy to any compatible Java 1.4 Business Server
5. Support multiple transfer protocols: In-vm,tcp,ssl,nio,udp,jgroups,jxta
6. Support for high-speed message persistence through JDBC and journal
7. Designed to ensure a high-performance cluster, client-server, peer-to-peer
8. Support Ajax
9. Support for integration with axis
10. It is easy to call the embedded JMS provider for testing
ACTIVEMQ speed is very fast, usually 10 times times faster than JBOSSMQ.
Pros : is a fast open source Messaging Component (framework) that supports clusters, equivalent networks, automatic detection, TCP,SSL, broadcast, persistence, XA, and j2ee1.4 containers seamlessly combined, and supports lightweight containers and Java virtual machines on most cross-language clients. Message asynchronous acceptance, reducing the coupling degree of software multi-system integration. Messages are reliably received, ensuring that messages are reliably stored in the middleware, and that multiple messages can also form atomic transactions.
Disadvantages: ACTIVEMQ default configuration performance is low, you need to optimize the configuration, but the configuration file is complex, ACTIVEMQ itself does not provide management tools; The document on the home page looks more comprehensive, but lacks an effective organization, the document is only fragments, the user is difficult to understand, second, The overall nature of the documentation is too strong. In the study stage can be found through maillist, see Javadoc, Analysis source code to understand.