Title: Agenda
1Message Queuing in Windows 2000
(MSMQ)Microsoft Hong Kong Ltd.
2Agenda
- MSMQ Overview
- Key Features and Benefits
- MSMQ Programming
- Related Technologies
- Beyond Windows 2000...
3Introducing Message Queuing
- Implementation of Asynchronous / Connection-less
Communication
- Requests are Sent, and Responses are Received, as
Messages
- Message-based Asynchronous Communication has Many
Benefits
- Delivery guarantees
- Routing
- Connection-less
- Security
4Agenda
- MSMQ Overview
- Key Features and Benefits
- MSMQ Programming
- Related Technologies
- Beyond Windows 2000...
5MSMQ Overview
- Message Queuing in Windows 2000 (MSMQ)
- MSMQ Scenarios
- Application Integration
- Internet/Intranet
- MSMQ Product Architecture
- MSMQ Configurations
6Message Queuing in Windows 2000 (MSMQ)
- Asynchronous Communication Model
- Detects/Avoids Network Problems
- Transactional Send/Receive
- One-way and/or Request/Response
Receive . Process . . . Respond
Send Request
Request Queue
Optional
Confirm or Reconcile
Response Queue
7MSMQ Distributed Draw Sample Application Overview
- Scenario Two applications passing keystrokes
and mouse coordinates to each other. When a
receiving application is not running, the
keystrokes and mouse movements are queued until
the application starts up again.
Demo
8Application IntegrationMSMQ Scenarios
IIS/ASP
Translation
Send Wait Receive
MSMQ
MQSeries
Bridging
Windows NT
Non-Windows NT
- Request/Response Communication
- Heterogeneous Application Architectures
9Internet/IntranetMSMQ Scenarios
- Use MSMQ for Asynchronous Aspects
10MSMQ Product Architecture
Machine 1
- Messages are Kept in Queues
MSMQ
- Queues are Managed by Queue Managers
- Applications Access MSMQ via a Simple Client API
- MSMQ Enables Program-to-Program Messaging Queuing
11MSMQ Product Architecture
Machine 1
MSMQ
- MSMQ Also Works Transparently in a Multi-Machine
Environment
12MSMQ Configurations
- MSMQ Server
- Windows NT 4.0 / Windows 2000 Server
- Optional routing functionality
- MSMQ Dependent Client
- Windows NT 4.0 / Windows 2000 Server
- Windows NT 4.0 Workstation /Windows 2000
Professional
- Windows 95/98
- MSMQ Independent Client
- Windows NT 4.0 Workstation / Windows 2000
Professional
- Windows 95/98
13MSMQ Server
MSMQ Server
- Support Local Applications
Information Server - AD
- Support Dependent Client Access
- Site Controller (optional)
- Host the MSMQ 1.0 MQIS
Windows NT Server
14MSMQ Dependent Client
- Send and Receive Messages
- No Local Message Storage
- Rely on an MSMQ Server Machine
- Works Best in LAN Environments
- Easy to Administer
- DLLs COM APIs
15MSMQ Independent Client
- Send and Receive Messages
MSMQ Workstation
- Can Operate if the Network is Lost
- Cannot Support Dependent Clients
- Cannot Act as an MSMQ Router
- Required for Mobile
16Agenda
- MSMQ Overview
- Key Features and Benefits
- MSMQ Programming
- Related Technologies
- Beyond Windows 2000...
17Key Features and Benefits
- Directory Service
- Administration
- Workgroup Support
- Security and Audit
- Performance
- Message Control
- Interoperability
18Directory Service
- MSMQ 1.0 Special-purpose SQL Server Database,
Single-master, Replicated by MSMQ
- MSMQ 2.0 and Beyond No More SQL Server - All
MSMQ DS Information Stored in the Windows 2000
ADS
- No need for customers to acquire SQL license(s)
- Simplifies deployment/management - only ADS is
required
19Directory Service MSMQ 1.0 DS MQIS
- SQL-Based, Replicated Database
- Supported by MSMQ 1.0 Site Controller
Installations
- One Primary Enterprise Controller (PEC)
- One Primary Site Controller (PSC) for each
physical site
- Backup Site Controllers (BSCs) as desired (load
balancing and failover)
- MQIS Must Be Installed Before Deploying MSMQ 1.0
Clients or Routing Servers
20Directory Service MSMQ 2.0 DS Active Directory
- No More SQL Server Requirement
- Simply Integrates with the Windows 2000 Active
Directory
- MSMQ 2.0 Allows Installing MSMQ Machines with No
Windows 2000 Domain/ADS Present
- Workgroup MSMQ
- For example, stand-alone Windows 98 machine
21AdministrationActive Directory Integration
- Manage MSMQ Objects
- Administration Model
- Single point of control
- Supports remote management
- Windows NT PerfMon counters
- Windows NT event log
- No Static Routing Tables on Individual Machines
- View-able via Computer Management
22Directory Service Administration
- Scenario Access the Active Directory to see
the queues created by the Distributed Draw
application. Then look at messages, properties,
and administration features.
Demo
23Local AdministrationMSMQ 2.0
- Works Offline (no ADS connectivity)
- Only Available Tool for Workgroup
- Shows
- Internal outgoing queues
- Local private queues
- Local public queues
- All queues if ADS available
- Otherwise, only those with messages
24Local AdministrationMSMQ 2.0
- MMC Snap-in Extension to Computer Management
- Allows
- Viewing messages
- Purging entire queue
- Stop/resume transmission out of specified
outgoing queue
- Stop/resume transmission for entire machine
25Workgroup SupportMSMQ 2.0
- Allows MSMQ Install without Windows 2000 Domain
- No Active Directory connection
- Local Administration Only
26Workgroup Support MSMQ 2.0
- No PUBLIC queues, only PRIVATE, using DIRECT
Format Name
- No Directory Service implies
- No MSMQ routing
- No security
- Explicit encryption
- No authentication
- Only Local Admin tool available
27Performance MSMQ 2.0
- Huge Performance Improvements
- Transactional delivery, especially
single-thread
- Recoverable receive multiple threads
optimization
- Examples
- Send, single-thread, DTC 79 TPS (vs 4 !)
- Receive, 5 threads, recoverable, standard SCSI
556 msgs/sec (vs 109 msgs/sec)
28Message Control
- Acknowledgments
- Negative, positive or both
- Sent to specified Admin queue
- Priorities
- Queue -32k - 32k
- Message 0 7
- Journaling
- Outgoing messages in machine journal
- Dequeued messages in queue journal
29Security and Audit
- Windows NT ACL Support
- Integration with Windows NT auditing
- Public Key-Based Authentication
- Encryption
- Combination of symmetric key and public key
- Journal Queues at Source and Target
- Dead-Letter Queues
30Interoperability
- Microsoft MSMQ-MQSeries Bridge
- Interface to any MQSeries 5.x platform
- NT 4.0 SNA Server 4.0 SP2 (requires Windows NT
4.0 Server Enterprise Edition)
- Windows 2000 Babylon
- Level 8 Systems, Inc. MSMQ Clients
- MSMQ API on a large number of platforms
- Today Dependent Client implementations
- Future Independent Client implementations
31MSMQ-MQSeries Bridge
- Interoperability with IBMs MQSeries
- Open MSMQ Connector Architecture
32Level 8 MSMQ Clients
Information Server
Client Proxy Server
Routing Server
Queue Manager
A
B
C
Sys
Sys
Windows 2000 Server
- Today Like MSMQ Dependent Clients
- Future With Queuing
33Agenda
- MSMQ Overview
- Key Features and Benefits
- MSMQ Programming
- Related Technologies
- Beyond Windows 2000...
34MSMQ Programming
- MSMQ Application Model
- MSMQ Interfaces
- C/C
- COM
- Delivery Options
- Component Model
- Queue/Message Syntax
35MSMQ Application Model
- Sender
- Opens a queue by name or lookup
- Creates message object
- Sets attributes such as body, timeout, delivery
mode, response queue name, etc.
- Invokes send method on message object passing
destination queue as a parameter
- Receiver
- Opens a queue by name or lookup
- Removes messages from the queue via blocking or
non-blocking receive
- Must send any required response messages
36MSMQ C/C InterfaceMSMQ Interfaces
- Primary APIs
- Open, Close queue
- Send, Receive message
- Additional functions
- Create, Delete queue
- Locate queue(s)
- Set/Get queue properties
- Set/Get queue security
- Miscellaneous
37MSMQ COM InterfacesMSMQ Interfaces
- MSMQ COM Components Integrated with VB, VC, VBA
Hosts, Scripting - VBScript, Many Others
- Supports Windows Events
- MSMQ Can Send Persistent COM Components as
Message Body
- Rowsets
- Spreadsheets documents
- Any COM object that supports IPersist
38Delivery Options
- Express
- Fast memory-based reliable store and forward
- Tolerates network loss
- Recoverable
- Disk-based guaranteed store and forward
- Tolerates machine reboot
- Transactional
- Exactly-once, in-order delivery
- Works with Microsoft Transaction Server
- XA-compliant resource manager
39Component Model
- MSMQQuery
- queue search
- MSMQQueueInfos
- queue collection
- MSMQQueueInfo
- queue object
- MSMQQueue
- open queue instance
- MSMQEvent
- asynch notification
- MSMQMessage
- message object
- MSMQApplication
- machine ID
40Component Model
- Transaction Support
- MSMQTransactionDispenser
- Creates MSMQ internal transaction
- MSMQCoordinatedTransactionDispenser
- Creates MS DTC transaction
- MSMQTransaction transaction object
41Queue/Message Syntax
- MSMQ Defined in Terms of Queue and Message
Objects
- Queue object types
- Public defined in directory service
- Private defined locally on computer
- Format Name uniquely identifies queue
- Messages object types
- User-defined body
- Persistent objects can be sent
- Message peek and removal supported
42Queue Syntax Queue Management
- Methods of MSMQQueueInfo
- Create queue
- .Create
- Delete queue
- .Delete
- Open queue
- .Open
- Close queue
- .Close
43Queue Syntax Queue Lookup
- Only for Public Queues
- Can Select Subset Based on Queue Properties with
Comparison Operators
Set qinfos queryFriend.LookupQueue( _
Label(FriendName), _
ServiceTypeGuidguidDraw)
44MSMQ ProgrammingLookup and Open the Queue
- Scenario Using the Distributed Draw
application, show the code for queue lookup and
queue creation.
Demo
45Message Syntax Send Message
- Sending a String Message
-
- If qFriend.IsOpen Then
- msgOut.Priority 4 'Set the
priority to 4 msgOut.Body Chr(KeyAscii)
'Fill the body with char
- msgOut.Label "Key " msgOut.Body
- msgOut.Send qFriend 'And send
the message
- End If
- Open queue for send access
- Create property set to define message
- Can Send Persistent Objects
- Receiving application must have the objects
interface installed
46MSMQ ProgrammingSending a Message
- Scenario Using the Distributed Draw
application, show the code for sending a message.
Demo
47Message Syntax Receive Message
- Receiving a Message
- Open queue for receive access
- Determine receive property set
-
- Set msgIn q.Receive(ReceiveTimeout100)
- To Receive Messages Without Removing Them from
the Queue
- Use the Peek methods
- MSMQQueue.Peek
- MSMQQueue.PeekCurrent
- MSMQQueue.PeekNext
48MSMQ ProgrammingReceiving a Message
- Scenario Using the Distributed Draw
application, show the code for receiving a
message.
Demo
49Agenda
- MSMQ Overview
- Key Features and Benefits
- MSMQ Programming
- Related Technologies
- Beyond Windows 2000...
50Related Technologies
- Queued Components
- Windows CE Devices
51Queued Components
- Leverage MSMQ Benefits
- Connectionless method invocations
- Client Records Method Invocations and Server
Plays Them Back
- COM
- Requires COM infrastructure deployment on both
server and client
- Implies control over both client and server
- Windows 2000 Only
52Queued Components
- No Complete Control over Message Format
- Support Passing Objects By Value
- Object parameters must support IPersistStream
- Establish Two-way Client/Server Communication by
Passing Client Recorder Object to Server
53Queued Components
- MSMQ Should Be Used When
- No control over receiver applications
- Interoperability with any non-COM system
- MSMQ Usage Examples
- Inter-company communication
- High-performance message broker server in
financial application
54Windows CE Devices
- MSMQ to Ship in Windows CE 2.12 SP2 and then
Windows CE 3.0
- Small MSMQ Footprint
- No Directory Service, DIRECT addressing only
- No security/authentication/encryption
- No remote read
55Agenda
- MSMQ Overview
- Key Features and Benefits
- MSMQ Programming
- Related Technologies
- Beyond Windows 2000...
56Beyond 2000
- MSMQ Everywhere
- Publish and Subscribe
- Miscellaneous
57MSMQ Everywhere
- Goal
- Allow MSMQ applications to assume MSMQ services
are available everywhere
- Install MSMQ as Part of Setup
- Today (Windows 2000) requires Add/Remove step
- Working Set
- 180K today (Windows 2000) - get as close as
possible to 0k on machines where MSMQ is inactive
58Publish And Subscribe
- Simple Pub/Sub API
- MQPublish publish an MSMQ message to a
subject
- MQSubscribe subscribe to a subject, specify
queue where messages will be placed
- Retain Familiar MSMQ Concepts
- Information is any MSMQ message
- Published messages end-up in MSMQ queues
- Efficient Delivery
59Miscellaneous
- Support Messages 4 MB
- Support Message Fragmentation
- Support 2 GB Total Message Storage
- Improvement in Startup Time
- Decouple Exactly-Once In-Order from
Transactional Delivery
- Deferred Delivery
60Call to Action
- Use Message Queuing in Windows 2000 for
Guaranteed Message Delivery
- Rely on MSMQ for Distributed Applications
- Interoperate with Other Platforms and Products
Using MSMQ
- Microsoft MSMQ-MQSeries Bridge
- Level 8 Systems, Inc FalconMQ Client
61Questions?
62Resources
- msdn.microsoft.com
- msdn.microsoft.com/osig/win2000
- www.microsoft.com/windows2000/ready
- msdn.microsoft.com/vstudio/win2000
- msdn.microsoft.com/winlogo/win2000.asp
- www.microsoft.com/dna
- www.microsoft.com/msmq
63(No Transcript)