Register your product to gain access to bonus material or receive a coupon.
"This book is an invaluable resource for learning about MSMQ."
--Peter Houston
MSMQ Product Manager, Microsoft Corporation
Microsoft Message Queue Server (MSMQ)--which is incorporated into the newest version of Windows NT--brings asynchronous transaction processing (TP) capabilities to the Windows platform for the first time. MSMQ combines the high performance and robustness of mainframe transaction processing with a flexibility of objects, an administrative ease-of-use, and an ability to scale. As such MSMQ is a key technology contributing to the growth of Internet commerce and intranet distributed processing.
Whether you are a Windows programmer who is new to transaction processing or a UNIX programmer who wants to learn more about MSMQ, this book will introduce you to the topic and show you how to develop transaction-processing applications using the MSMQ technology.
Designing Applications with MSMQ offers an overview of the general design of queued messaging applications and a discussion on how MSMQ can be used in two-tier, three-tier, Web, and component architecture applications. This book also provides a detailed description of MSMQ architecture, queue, and message properties, as well as a detailed description of how MSMQ interacts with other transaction technologies, such as MTS and SQL Server.
A step-by-step tutorial shows you how to write MSMQ applications using COM components, Visual Basic, Visual C++, and the MSMQ API. In addition to the tutorial, this book offers a comprehensive introduction to transaction processing and develops a full-scale application using MSMQ that illustrates the technology's power and potential for this emergent field.
1. Distributed Architectures and Microsoft Message Queue Server (MSMQ).
Introduction to MSMQ Application Architectures.
Using MSMQ in Well-Known Distributed Application Architectures.
The Future of MSMQ.
Conclusion.
Resources and References.
Selected Definitions.
Programming Interfaces.
Messages and Message Queues.
Sending and Receiving Messages.
MSMQ Architecture.
Integration with non-MSMQ Messaging Environments.
Conclusion.
Resources and References.
Properties.
Queue Naming.
Conclusion.
Resources and References.
Overview of Hello World.
MSMQ COM Components.
Queue Creation.
Locating Queues.
Creating the Hello World Sender Form.
Opening Queues and Sending Messages.
Receiving Responses.
Closing Queues.
The Hello World Receiver.
Summary.
Resources and References.
Overview of Hello World.
Working with Properties in the MSMQ API.
Creating Queues.
Locating Queues.
Opening, Closing, and Deleting Queues.
Receiving Messages and Sending a Response.
The Hello World Sender.
Sample Program Output.
Conclusion.
Resources and References.
Hello World Program Analysis.
Queue Options.
Messages and Message Property Options.
Summary.
Resources and References.
Converting Message and Correlation IDs to Strings.
Request and Response Correlation.
Asynchronous Message Processing.
Handling Variable-Length Messages.
Multipart Message Sequences.
Object Shipping.
Working While Off Line.
Conclusion.
Resources and References.
Overview of MSMQ Facilities.
Making Messages Recoverable.
Setting Up Message and Queue Journals.
Tracing Message Routing.
Acknowledging Messages.
Recovering and Tracing Messages.
Conclusion.
Resources and References.
Authentication.
Message Encryption.
MSMQ Access Controls.
Managing Queue Access Programmatically.
Access Event Auditing.
Conclusion and Recommendations.
Resources and References.
Basics of Transaction Processing.
The ACID Properties.
Distributed Transaction Processing.
Transactional Queued Messaging.
When to Use On-Line or Queued Transactions.
Conclusions and Recommendations.
Resources and References.
Basics of Transactional Messaging.
External Transactions.
Internal Transactions.
In-Order Delivery.
Conclusion.
Resources and References.
COM Components.
MSMQ API Functions.
Queue and Message Properties.
Creating and Configuring a Project in Visual C++.
Creating and Configuring a Project in Visual Basic.
Messaging Performance.
There may be no more fascinating arena to work in these days than the computing industry. We seem to be continually challenged by technological and design revolutions and counterrevolutions, especially in the area of distributed processing. Today software architectures are evolving, and new languages compete for mind share and market acceptance. Processor speeds and network technologies accelerate to accommodate increased distribution.
The world is witnessing several shifts in the way it develops distributed applications.
Into this space Microsoft has introduced two key technologies: Transaction Server and Message Queue Server. Microsoft Transaction Server (MTS) adds transactions to the object model defined by Microsoft's Component Object Model (COM). Message Queue Server (MSMQ) supports asynchronous transaction processing, whereby applications exchange messages through a message queue. Although less understood by the developers of smaller, two-tier applications, queued messaging has provided the bulk of transaction processing in non-Windows environments for decades.
But MSMQ stands apart from queued messaging technologies of the past. It combines the high-performance communications and reliability of mainframe transaction processing technologies with the flexibility of objects and the large-scale distribution of intranets and the Internet.
Great! MSMQ is an exciting new technology. But why would you be interested in this book? Simply stated, this book offers a lot to various groups of readers.
Although this book has an MSMQ and COM orientation, I have attempted to convey information that is useful outside those contexts. Selected chapters, sections, and paragraphs will be of value to readers who use other messaging environments or other component frameworks.
If you are a programmer who will be developing MSMQ applications, I assume that you are proficient in Visual Basic or C/C++. In addition, you should be familiar with Windows as a user. This text does not assume Windows programming knowledge, but that knowledge certainly helps. Also, information systems executives and managers need not be developers to derive value from this book.
This book does not go step by step through MSMQ Enterprise, Site, Server, and Client setup. I discuss design trade-offs in Chapter 2 and demonstrate creation of queues in Chapter 4. However, MSMQ makes setting up an Enterprise, Sites, Servers, and Clients straightforward. It does not warrant duplication here.
This book also ignores the creation of e-mail and connector applications. I would be interested in hearing from readers as to whether they want these or other topics covered in a future release of this book.
Chapter 1 tells how queued messaging is similar and different from other forms of communications. Then it describes how MSMQ can be used in two-tier, three-tier, Web, and component architectures. This chapter will be useful to IS executives, development managers, and programmers with limited backgrounds in distributed applications or object-oriented concepts.
MSMQ delivers terrific deployment flexibility and administrative ease of use. These features are highlighted in Chapter 2 as part of a detailed overview of the MSMQ architecture. Level 8 Systems technologies are also described, since most companies will need to integrate non-Windows resources with MSMQ (and vice versa).
Any MSMQ application needs to understand how queues can be configured and messages can be exchanged. In an MSMQ architecture, queues and messages are modeled as objects and have properties associated with them. Chapter 3 introduces queue and message properties. It also describes the kinds of queue names that MSMQ applications must use.
Chapter 4 uses Visual Basic to teach basic queued messaging. In this chapter we implement a version of the well-known Hello World application, using COM components. In Chapter 5 the exercise is repeated, using Visual C++ and the MSMQ (C language) API. COM components can be used in C++ programs and Java applets. (The COM examples contained in Chapter 4 and other chapters could easily be converted to those languages.)
Chapter 6 begins with a critique of the Hello World applications developed in Chapters 4 and 5. Using those applications, we illustrate queue and messaging architectures that satisfy various project goals, requirements, and assumptions.
Several processing scenarios are common in messaging environments. For example, client applications usually need to correlate a request and a response. Also, servers may want to conserve processing resources by triggering processing only when a message is available. These and other processing requirements are implemented in Chapter 7.
One of the differences between queued messaging and on-line kinds of communication, such as remote procedure calls (RPCs), is that they provide much richer failure handling. Messages can be made recoverable and can be copied to journal queues on the source and destination machines. You also have the ability to trace the route that the message takes through a network and can receive acknowledgments that a message reached a receiver or its target queue. Chapter 8 demonstrates how to use these facilities in your program and suggests how they may be used in administrative programs.
MSMQ security is particularly attractive. Chapter 9 discusses MSMQ administrative and programmatic security features. Administrative operations, including configuring access control and auditing, are demonstrated. Program-to-program authentication and message encryption are implemented.
Chapter 10 introduces transaction processing concepts. It begins by describing the value of transaction processing. Atomicity, consistency, isolation, and durability are explained. Then the chapter elaborates on several issues relating to distributed transaction processing. It examines the strengths and weaknesses of on-line distributed transaction processing systems and queued messaging. Compensating transactions and the two-phase commit protocol are also reviewed.
A transactional queued messaging application is developed in Chapter 11. It illustrates how to transactionally send and receive messages, as well as how to combine these operations with other transactional operations, such as database updates.
Appendix A provides a brief reference to COM components and the MSMQ API. Appendix B describes how to set up MSMQ projects in Visual C++ and Visual Basic. MSMQ performance test results are described in Appendix C, and hints are offered.
The industry is still in the early stages of delivering infrastructures for the development of distributed transactional object systems. Likewise the art of developing distributed transactional object applications is in its infancy. This book attempts to address many basic questions a reader might ask. Complete coverage is a noble goal but is one that no author can hope to achieve.
Luckily resources are available to help you solve your problems. Microsoft does a great job of making its products accessible to users through the Web. You can expect to see Microsoft place white papers on its Web site. Information related to MSMQ can be found at:
http://www.microsoft.com/ntserver/nts/appservice
PSW Technologies also has several resource pages devoted to MSMQ, transaction processing on Windows NT, and porting applications from UNIX to Windows. Please visit our Web site at:
For information about connecting MSMQ to non-Windows platforms, visit the Web site of Level 8 Systems for information about their message queuing solutions:
When all else fails, you can communicate via e-mail. Please address questions to:
Writing a book is challenging and tiring. Above all, it is a humbling experience. I have benefited in so many ways from numerous people.
My book reviewers were terrific. Thanks to Oran Bodner, Ilan Caron, and Alexander Dadiomov at Microsoft, who helped me sort through a lot of technical details. Melodi Gates, Jay Lang, Ken Walker, and Gene Belitski offered great suggestions and practical insights.
Others at Microsoft were very helpful, too! Peter Houston made human and intellectual resources available to me. Amnon Horowitz, Doran Juster, Nir Katz, and Syed Yousef contributed a lot of time. I owe a tremendous debt to Dr. Frank King, as well as to Brian Baisley, Bill Cason, Dennis Thompson, Christine Kungl, Mike McCown and others of PSW Technologies for giving me the time to explore MSMQ and the resources to write. Thanks to Reid Spencer of PSW Technologies for reviewing parts of this book. Also, thanks to several readers of Microsoft's MSMQ newsgroups for sharing their questions and experience.
Special thanks to Carter Shanklin, Elizabeth Spainhour, Genevieve Rajewski, John Fuller, Krysia Bebick, and others who have made working with Addison-Wesley such a pleasant experience.
Finally, my family and friends stayed out of my way when I was working and distracted me when I needed a break.
--Alan Dickman
PSW Technologies, Inc.