310 likes | 529 Views
Topics to be Covered. Recap traditional synchronous programming in the Microsoft world (COM/DCOM), focusing on the need for asynchronous communicationQuick introduction to Message Queuing (MSMQ) and what it brings to developersIn-depth look into Queued Components (QC)Architecture built on top
E N D
2. Topics to be Covered
Recap traditional synchronous programming in the Microsoft world (COM/DCOM), focusing on the need for asynchronous communication
Quick introduction to Message Queuing (MSMQ) and what it brings to developers
In-depth look into Queued Components (QC)
Architecture built on top of MSMQ
Asynchronous communication
How to create objects through QC
Demonstration
3. Synchronous Programming
4. Traditional COM and DCOM
Component Object Model (COM)
Binary standard of interfaces
Provides a foundation to build component based applications upon
Distributed COM (DCOM)
Use Remote Procedure Calls (RPC)
Utilizes a Proxy and Stud to handle marshalling
Transparent to the programmer, but not within the architecture
6. Sample Sync Programming - Code
7. Sample Sync Programming – Diagram
8. Long processing time, especially on the web
Page time outs (ASP)
Data access time outs
Why hold the client up when they could be processing other transactions?
Availability
What if a server is unavailable and/or unreliable? Should this stop the users from using the system?
Does the client care?
No feedback that is require to send back to the user
Where Does Synchronous Processing Fail?
9. MSMQ
10. Message Queuing
MSMQ 1.0 appeared with the NT 4.0 Option pack
MSMQ 2.0 comes with Windows 2000 and is intergraded into the Active Directory
Allows for distributed applications to communicate using a reliable and secure architecture
Allows asynchronous communication among applications
Great for situations that do not require immediate responses
12. Main Parts of Message Queuing Queues
Designed to hold messages, Contain security rights (send, receive, admin, etc.)
Messages
Label - similar to a subject on an email. Usually used to distinguish various types of messages in a single queue.
Body – a versatile part of a MSMQ message. It can hold a single numeric value, string, array, or even an COM object that supports the IPersistStream or the IPersistStorage interface (like an ADODB Recordset)
Many Others such as Priority, Delivery Mode, and various security and privacy settings, just to name a few.
13. Main Parts of Message Queuing – Cont. Sender
Usually the requester of some functionality
Comprises the message and sends it off to the queue
Receiver
Cares out the request from the sender. This work is usually what would have been processed on the client (client-side executable, IIS, etc.), but has been asynchronously moved another process.
Also the communication between the client and server is asynchronous; the receiver can response to the messages from MSMQ both synchronously and asynchronously.
14. Typical MSMQ Interaction in a Web App
15. Sample MSMQ Code – Sending
16. Sample MSMQ Code – Receiving
17. COM+ QC
18. COM+ Queued Components
COM+ QC form a very exciting architecture for all COM developers.
Provides most of the benefits from MSMQ, with out the headache of MSMQ and handling all of the exceptions it brings
Asynchronous communication without the hassle!
Work well in a disconnected environment or when resources are not always available
Configurable via the Component Administrator in Windows 2000
19. QC Benefits
Component Lifetimes – The server and client do not have to exist at the same time, they communicate asynchronously
Availability – The desired component may not be available due to an unreliable network or pure overload
Disconnected Application – Great for laptops!
Message Reliability – Pulls the benefits of guaranteed message delivery from MSMQ
Scheduling – QC can be configured to only process messages during set times, which is a great way to move processor intensive tasks to nightly processing.
20. What are Queued Components?
QC's are actually just an architecture to build upon
Comprised of four parts: Recorder, MSMQ, Listener, Player
Recorder - Logs the interaction (method calls) between the the client and that the client thinks is the component. It takes this log and builds a message and sends it to MSMQ. Actually the recorder is able to impersonate the object the consumer request.
MSMQ – Holds the message in series of queues.
22. Queued Components Interaction
23. How to Use Queued Components
25. How to Configure Queued Components Use Component Service MMC snap-in
Mark COM+ application as queued
Mark interface as queued
26. Queued Components Restrictions
No ByRef Parameters
No return values
Sub-routines only
The client (IIS in the web / client-side executable in a tradition client-server application) and server must both be Windows 2000
27. Demonstration
29. Recap COM+ Queued Components
Why
Synchronous programming not tolerant to unavailable resources and long processing time, and does not support disconnected users
If you want a lot of control and have a lot of custom requirements, or just have upgraded from Windows NT 4.0 use MSMQ
If you need to get things done and do not require a lot of immediate feedback COM+ Queued Component is a great solution.