Free Programming Books
Free download ebooks on computer and programming

Free ebook "Database Programming with VB.NET" Sample Chapter

Database Prog. with VB.NET
Free download chapter 8: Message Queues
Download chapter

Database Programming with Visual Basic .NET functions as a reference book. But thanks to its many listings and tables, you'll find value reading it cover to cover! This book is all you need to get started with data access in VB .NET.

Author Carsten Thomsen includes step-by-step coverage of everything you ever wanted to know about ADO.NET. Thomsen also covers relational databases, Active Directory (LDAP) access, and MessageQueue.

< < prev next > >

Message Queues

Using message queues for connectionless programming

MESSAGE QUEUES ARE GREAT whenever you don't have a permanent connection or in loosely coupled situations. They're also handy when you simply want to dump your input and return to your application without waiting for the output from whatever application or server will be processing your input. You can make message queues the basis of a fail-safe application that uses them whenever your regular database fails. This can help ensure that no data is lost and you have very little or no downtime at all, if you use transactional queues. Obviously not all applications can use message queues to such advantage, but for storing or accepting customer input it can be a great solution. One situation springs to mind in which using message queues would not be beneficial and that is a banking transaction that needs to be processed in real-time.

Microsoft's messaging technology is called Message Queuing. Mind you, in line with other traditional Microsoft marketing stunts, this technology has had other names before Windows 2000 was shipped. However, the release that ships with Windows 2000 is built upon a previous version of the technology and includes the Active Directory (AD) integration. AD integration is good because it is now easier to locate public message queues across your domain and it ensures easy Enterprise-wide backup.

Connectionless Programming

Connectionless programming involves using a queue to hold your input to another application or server. Connectionless in this context means you don't have a permanent connection to the application or server. Instead, you log your input in a queue, and the other application or server then takes it from the queue, processes it, and sometimes puts it back in the same or a different queue. The opposite of connectionless is connection oriented, and basically any standard database system these days falls into this category. You have probably heard these two terms in relation to TCP/IP (Transmission Control Protocol/Internet Protocol). The UDP (User Datagram Protocol) part of the protocol is connectionless, and the TCP part is connection oriented. However, there is a major difference between message queuing and the UDP protocol. Whereas the UDP protocol does not guarantee delivery, and a packet sent over the network using the UDP transport protocol can be lost, the message queue doesn't lose any packets. The reason why a message queue is said to be connectionless is that your client doesn't "speak" directly with your server. There is no direct connection, as there is with a standard database.

Now that you have an understanding of connectionless programming, let's move on to an overview of the MessageQueue class.