Message queue technology is the exchange of information between distributed applications of a technology.Message queue can reside in memory or on disk, store the message queue until they are read by the application to go.Through the message queue, the application can execute independently - they do not know each other's position, or continue to wait before receiving program does not need to receive this message.
Overview of Message Oriented Middleware
Message queue technology is the exchange of information between distributed applications of a technology.Message queue can reside in memory or on disk, store the message queue until they are read by the application to go.Through the message queue, the application can execute independently - they do not know each other's position, or continue to wait before receiving program does not need to receive this message.
In a distributed computing environment, in order to integrate distributed applications, developers need a distributed heterogeneous network environment to provide an effective means of communication applications.To manage the need to share information, provide public information on the application of the exchange mechanism is important.
Design of the main methods for distributed applications: Remote Procedure Call (PRC) - Distributed Computing Environment (DCE) component of basic standards; Object Transaction Monitor (OTM) - Based on industry-standard CORBA object-oriented and transaction processing(TP) monitor technology portfolio; message queue (MessageQueue) - method of construction of loosely coupled distributed applications.
(A) Distributed Computing Environment / Remote Procedure Call (DCE / RPC)
DCE RPC is the composition, is an Open Software Foundation (OSF) released a software application integration standards.RPC function reference used to imitate a program to refer to another program of traditional programming methods, this reference is in the form of procedure calls, once called, the program control is turned to the called program.
In the RPC implementation, the process can be invoked locally or remotely to another system that resides in the implementation.When the called program finishes processing input data, the results on the process variables of a call to return to the caller.After RPC program control returns to the calling program immediately.Therefore, imitation RPC subroutine call / return structure, it provides only a Client (caller) and Server (called process) synchronization between the data exchange.
(B) Object Transaction Monitor (OTM)
Based on industry-standard CORBA object-oriented and transaction processing (TP) monitor technology portfolio, defined in the CORBA specification: object-oriented architecture technologies and methods; public Client / Server Programming Interface; multi-platform transfer betweenand translation of data guidelines; Developing Distributed application interface language (IDL), etc., and the structure distribution of the Client / Server application provides a broad and consistent pattern.
(C) Message Queue (Message Queue)
The message queue is constructed to achieve synchronous or asynchronous mode provides a loosely coupled distributed application methods.Message Queue API calls are embedded into new or existing applications, through the message is sent to memory or disk-based queue or read from it to provide information exchange.Message queue can be used in applications to perform multiple functions, such as request for service, the exchange of information or asynchronous processing.
Middleware software is a stand-alone programs or services, distributed applications using this software to share resources between different technologies, management of computing resources and network communications.It is a critical computer system software, it can realize the application of the interconnection and interoperability, to ensure the system safe, reliable, efficient operation.Middleware and operating systems in user applications and network software between the applications it provides a common means of communication, and independent of the network and operating systems.Middleware provides developers with the public and the environment for all application programming interfaces, when the application is to embed the function call, it can be run using its operating system and network environment-specific features for application execution communications.
If you do not complete the exchange of information messaging middleware, application developers to transfer data, we must learn how to use the network and operating system software functions to prepare the appropriate application to send and receive information, and there is no standard way to exchange information, each applicationwhich must be specific and multi-platform programming, under different circumstances one or more application communications.For example, to implement the system on the network communication between different hosts, the network will be required to have knowledge of how the exchange of information (such as using TCP / IP, socket programming); In order to achieve the same host in the communication between different processes, will requirewith the operating system message queue, or named pipes (Pipes) and other knowledge.
Currently, many different types of middleware, such as transaction management middleware (such as IBM's CICS), Java application for Web application server middleware (such as IBM's WebSphere Application Server), etc., and message transmission middleware (MOM) is one of theA.It simplifies data transmission between applications, shielding the underlying heterogeneous operating systems and network platform to provide consistent communication standards and application development, distributed computing network environment to ensure reliable, cross-platform information transmission and data exchange.It is based on message queue storage - forwarding mechanism, and provide unique asynchronous transfer mechanism to transfer and asynchronous message-based transaction processing to achieve application integration and data exchange.
IBM MQ messaging middleware security mechanisms for its unique, simple and fast programming style and distinguished stability, scalability and cross-platform, as well as a powerful transaction processing and messaging communications capabilities, the highest market share of the industrymessaging middleware products.
MQ has a powerful cross-platform, the number of platforms it supports up to 35 species.It supports all major Unix operating system platforms, such as: HP-UX, AIX, SUN Solaris, Digital UNIX, Open VMX, SUNOS, NCR UNIX; support a variety of host platforms, such as: OS/390, MVS / ESA, VSE /ESA; also supports Windows NT server.In the PC platform support Windows9X/Windows NT / Windows 2000 and UNIX (UnixWare, Solaris), and major Linux versions (Redhat, TurboLinux, etc.).In addition, MQ also supports various other operating system platforms, such as: OS / 2, AS/400, Sequent DYNIX, SCO OpenServer, SCO UnixWare, Tandem and so on.
MQ basic concepts:
1) The queue manager
MQ queue manager is the top-level system, a concept, which will provide us with queue-based messaging services.
2) Message
In MQ, we have the application data transmitted by the MQ is defined as the message, we can define the message content and message in a broad sense, such as: Users of all types of data files, an application sent to other applicationsprocessing the request so as a message.Message has two parts:
Message descriptor (Message Discription or Message Header), describes the characteristics of the message, such as: the priority of the message, life cycle, message Id and so on;
Message body (Message Body), part of the user data.In MQ, the message is divided into two types, non-permanent (non-persistent) messages and permanent (persistent) message, the message is stored in permanent memory, which is designed to improve performance, when the systemPower-down or MQ queue manager restarts, will not be restored.The reliability of the message when a user less demanding, and focused on the performance of the system, you can use the types of messages, such as: When publishing stock information, the stock information is constantly updated, we may be every few secondsPublished a new message will continue to overwrite the old news.Persistent message is stored on the hard drive and record the data log, it has high reliability, network and system failure in such circumstances to ensure that the message can not lose, not weight.
In addition, in MQ, there are logical messages and physical messages concept.Using logical messages and physical messages, we can handle large messages section, you can also complete a number of messages in the application itself, logically grouped together for processing.
3) the queue
Safe storage of the message queue, the queue stores the message until it is application processing.
Message queue in the following way:
a) A form of program message queue system calls, this call to inform the message queue system, the message is ready to invest in process B;
b) message queue system sends this message to the process B resides at the system, and put it in Program B of the queue;
c) the appropriate time, the program B reads from its message queue, and process this information.
As a result of the advanced program design, and internal working mechanism, MQ in a variety of network conditions to ensure reliable message delivery, can overcome the poor quality of network lines or unstable situation, in the transmission process, if the communication line failure orthe remote host fails, the local applications are not affected, you can continue to send data without waiting for network fault recovery or re-run after the normal remote host.
In MQ, the queue is divided into many types, including: local queue, remote queue, queue template, dynamic queue, the alias queue and so on.
Local queue is divided into general local queue and transmission queue, the queue is the common local application of its read and write through the API queue; transmission queue can be understood as storage - forwarding queue, such as: we will be a message to the MQ systemsent to the remote host, but this time the network fails, MQ will queue the message on the transmission buffer, when the network is restored, and then sent to a remote destination.
Purpose of the remote queue is defined in the local queue, which is similar to an address pointer to a remote host on the destination queue, it is just a definition, do not really take up disk storage space.
Templates MQ queue and dynamic queue is a feature of one of its typical use is for the system scalability consideration.We can create a template queue, when the future need to add the queue when you open a template for each queue, MQ will automatically generate a dynamic queue, we can also specify the dynamic queue, the queue for the temporary or permanent queue, if we have a temporary queueYou can turn it off at the same time it removed, on the contrary, if a permanent queue, we can keep it permanently, as I used.
[Next
4) channels
Channel is the MQ queue manager system, passing messages between the pipes, it is built on top of the physical network connection, a logical concept, but also the essence of MQ product.
In MQ, there are three main types of channel types, namely, news channel, MQI channel and Cluster channels.MQ message channel is used to transfer between servers and server messages, you need to stress that the channel is one-way, and it have sent (sender), Receive (receive), requester (requestor), serviceswho (server) and other different types, for users in different circumstances.MQI channel is between the MQ Client and MQ Server communication and transmission of messages used, and the news channel with its transmission in both directions.Cluster (Cluster) channel is located within the same MQ queue manager cluster communication between use.
First look at the case of local communications, the application A and application B running on the same system A, they can make use of message queues between each other's communication technology: application A sends a message to the queue 1, and when the need for the application Bwhen you can get the information.
Followed by the case of remote communication, if the goal of information transmission to the system application on B C, this change will not affect the application A, application A sends a message to the queue 2, the system A, MQ foundThe purpose of the queue Q2 is actually pointing in the system B, it will be a special information on the local queue - the transfer queue (Transmission Queue).We have established a system A to system B from the news channel, the message channel agent read a message from the transmission queue, and passing this information to the system B, then wait for confirmation.B MQ successful only to the system after confirmation of receipt of the information, it was really from the transmission queue to delete this information.If the communication lines blocked, or the system B is not running, the information will remain in the transmission queue until it is successfully transmitted to the destination.This is the most basic and most important of MQ technology - to ensure the information transmission, and is once and only once (once-and-only-once) delivery.
MQ provides a loosely coupled application integration for the connection method, because the application does not need to share information with each other to know the physical location (network address); do not know how to establish communication with each other; do not need to be running simultaneously; not in the sameoperating system or network environments.
The basic configuration example MQ
In the figure above, to achieve the two hosts on the network communication, the use of a point to point communication, we must at least create the following MQ objects:
The sender A:
1) the establishment of the queue manager QMA: crtmqm-q QMA
2) Define a local transmission queue: define qlocal (QMB) usage (xmitq) defpsist (yes)
3) Create a remote queue: define qremote (QR.TOB) rname (LQB) rqmname (QMB) xmitq (QMB)
4) Define the transmit path: define channel (A.TO.B) chltype (sdr) conname (''IP of B'') xmitq (QMB) + trptype (tcp)
In the receiver B:
1) the establishment of the queue manager QMB: crtmqm-q QMB
2) Define a local queue QLB: define qlocal (LQB)
3) Create a receiver channel: define channel (A.TO.B) chltype (rcvr) trptype (tcp)
After the above configuration, we can achieve from host A to B one-way communication, to achieve two-way communication between the two, may refer this case to create the required MQ objects.
MQ mode of communication
1) point to point communication: point to point mode is the most traditional and common means of communication, it supports one to one, many, many to many, many to one and other configurations to support the tree, mesh, etc.a variety of topologies.
2) Multicast: MQ for different types of applications.One of the important, and it is being developed in a "multicast" applications that can send messages to multiple target sites (Destination List).You can use a MQ command to a single message to multiple target sites, and ensure reliable delivery of information for each site.MQ not only provides multicast functionality, but also with intelligent message distribution function, a message will be sent to multiple users on the same system when, MQ, a copy version of the message and the system sent to the recipient listtarget MQ system.Target MQ system in the local copy of these messages and send them to the list of the queue, thus minimizing network traffic.
3) Publish / Subscribe (Publish / Subscribe) mode: publish / subscribe message distribution function of the queue for the purpose of the geographical point to break the restrictions, so that the message in accordance with the specific topic or content distribution, user or application can be received according to theme or contentto the desired message.Publish / subscribe feature allows the sender and recipient relationship between the even more loosely coupled, the sender need not care about the destination address of the recipient, but do not have to care about the message recipient to send the address, but only under the theme of the message the messagetransceiver.In the MQ family of products, MQ Event Broker is dedicated to using the publish / subscribe technology for data communication products, which supports queue and directly based on TCP / IP are two ways to publish and subscribe.
4) cluster (Cluster): point to point communication mode in order to simplify the system configuration, MQ provides Cluster (cluster) solution.Cluster is similar to a domain (Domain), the internal cluster communication between the queue manager does not need a message between any two channels, instead of using the cluster (Cluster) and the other members of the communication channel, which greatly simplifies system configuration.In addition, the cluster queue manager can automatically load balance between, when a queue manager fails, the other queue manager can take over its work, thus greatly improving system reliability.
MQ Server and MQ Client
MQ Server and Client products are divided into two versions, the MQ server operating environment, there is the queue manager, queues, message channel and other objects, which provides comprehensive information services; MQ Client has provided us with an MQ application developmentand the operating environment, it is the Client MQ API implementation.In the client environment, there is no queue manager, queues and other objects, it is through the MQI channel communication between the server and the message from the client to the server queue, or from the Server side of the queue to obtain message, it is more suitablein real-time communication network conditions or the situation better.At the same time to point out that: The MQ Client and will not cause data loss or incomplete.MQ Client provides the following benefits: the operating mode for synchronization; reduce system burden; reduce system management overhead; reduce disk space requirements.
MQ's API
MQ supports a variety of programming languages, including: C, C + +, Java, VisualBasic, COBOL, PL / 1, RPG, etc., but also support a variety of popular development tools, such as: WebSphere Studio Application Developer, PowerBuiler, Microsoft Visual C + +,Visual Basic, Delphi and so on.And, MQ on different platforms to provide a unified programming interface, just recompile the different platforms can be completed the transplant procedure.MQ's API interface, is very easy to learn, users only need to use MQ's popular and powerful 13 function calls, they can as quickly as possible, to write complex applications.Users can concentrate on application business logic implementation, rather than the underlying communication, exception handling and so on.
The C language, for example, an MQ application development process is as follows:
MQCONN () / * create a connection with the queue manager * / MQOPEN () / * Open the queue to read and write * / MQPUT () / * message in the queue * / MQGET () / * read from the queuetake the message * / MQINQ () / * check the queue properties * / MQSET () / * set queue attributes * / MQCLOSE () / * reading and writing operations in the finished, turn off the queue * / MQDISC () / * offOpen a connection with the queue manager, the release of relevant resources * /
source: http://www.softcov.com/software-products/getting-started-with-websphere-mq-messaging.html