+ All Categories
Home > Documents > Building Windows ® DNA Applications Today Using Information Server (IIS), Microsoft ® Transaction...

Building Windows ® DNA Applications Today Using Information Server (IIS), Microsoft ® Transaction...

Date post: 13-Dec-2015
Category:
Upload: ursula-hines
View: 219 times
Download: 0 times
Share this document with a friend
Popular Tags:
67
Building Windows Building Windows ® DNA DNA Applications Today Using Applications Today Using Information Server (IIS), Information Server (IIS), Microsoft Microsoft ® Transaction Transaction Server (MTS), And Server (MTS), And Microsoft Microsoft Messaging Queue (MSMQ) Messaging Queue (MSMQ) Joe Homnick And Shervin Shakibi Joe Homnick And Shervin Shakibi [email protected], [email protected], [email protected] [email protected]
Transcript

Building WindowsBuilding Windows®® DNA DNA Applications Today Using Applications Today Using Information Server (IIS), Information Server (IIS), MicrosoftMicrosoft®® Transaction Server Transaction Server (MTS), And Microsoft (MTS), And Microsoft Messaging Queue (MSMQ) Messaging Queue (MSMQ)

Joe Homnick And Shervin ShakibiJoe Homnick And Shervin [email protected], [email protected]@homnick.com, [email protected]

AgendaAgenda

What is a Windows DNA application?What is a Windows DNA application? Designing a three-tier architectureDesigning a three-tier architecture Building business logic componentsBuilding business logic components Incorporating transaction servicesIncorporating transaction services Using message queuingUsing message queuing Scalability and performanceScalability and performance

Windows DNA ApplicationWindows DNA Application

ScalableScalable High performance/high availabilityHigh performance/high availability

Fault-tolerantFault-tolerant Handle hardware and network failuresHandle hardware and network failures

ExtensibleExtensible Modular design Modular design Integrates with existing back endIntegrates with existing back end

““End-to-end” application solutionEnd-to-end” application solution

Internet Information Server, Internet Information Server, MTS, And MSMQMTS, And MSMQ Infrastructure services Infrastructure services

Scripting and component hostingScripting and component hosting Transaction capabilitiesTransaction capabilities Asynchronous communicationAsynchronous communication Security and administrationSecurity and administration

Structured framework that allows Structured framework that allows the development of distributed the development of distributed applications using Web technologyapplications using Web technology Inherently a three-tier architectureInherently a three-tier architecture

Three-Tier ApplicationThree-Tier Application

PresentationPresentation User interfaceUser interface Simple data validationSimple data validation

Middle tier/business logicMiddle tier/business logic Business rulesBusiness rules Consolidate data from multiple sourcesConsolidate data from multiple sources

Data services Data services Data integrity rulesData integrity rules Not just RDBMS - e-mail, file system…Not just RDBMS - e-mail, file system…

PresentationPresentation Business logicBusiness logic Data servicesData services

Internet Internet ExplorerExplorer

OthersOthers

Inte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTS

DCOMDCOM

SQL ServerSQL Server

OracleOracle

MicrosoftMicrosoftExchangeExchange

MSMQMSMQ

Compo

nent

s

Compo

nent

s

HTTPHTTP

HTTPHTTP

Three-Tier Web ArchitectureThree-Tier Web Architecture

Exploration AirlinesExploration AirlinesDemonstrationDemonstration

How Do I Build A Windows How Do I Build A Windows DNA Application Today?DNA Application Today?

ExAir Ticket SubmissionExAir Ticket Submission

What happens when the user What happens when the user hits the “Finish” button?hits the “Finish” button? An Active Server Page (ASP) An Active Server Page (ASP)

is called using a standard HTTP is called using a standard HTTP request, and is passed all of the request, and is passed all of the relevant order informationrelevant order information

Business Logic is performed on the Business Logic is performed on the server; success or failure of the ticket server; success or failure of the ticket ordering operation is determinedordering operation is determined

Appropriate HTML is returned to client Appropriate HTML is returned to client

Active Server PagesActive Server Pages

ASP is server-side script embedded in htmlASP is server-side script embedded in html Invocation through standard HTTP requests Invocation through standard HTTP requests

results in no firewall problemsresults in no firewall problems

Can target any browser on any platformCan target any browser on any platform ASP runs on the server -> returns HTMLASP runs on the server -> returns HTML

Multiple Scripting Languages SupportedMultiple Scripting Languages Supported Visual BasicVisual Basic®® Scripting Edition, JScript Scripting Edition, JScript®®, PERL, , PERL,

REXX, Python…REXX, Python…

Automatically supports use of “Session” Automatically supports use of “Session” and “Application” metaphorsand “Application” metaphors

ExAir Business LogicExAir Business Logic

ASP is the critical glue that binds ASP is the critical glue that binds the user interface on the browser with the user interface on the browser with the business logic on the serverthe business logic on the server

ASP alone does not provide the code ASP alone does not provide the code modularity, maintainability, and modularity, maintainability, and scalability that business apps requirescalability that business apps require

We recommend that ASP is used to call We recommend that ASP is used to call MTS-enabled COM components to MTS-enabled COM components to perform business logic, then send back perform business logic, then send back the appropriate HTML responsethe appropriate HTML response

Business Logic With COMBusiness Logic With COM

Business Logic Components Business Logic Components in COM can be written with a variety in COM can be written with a variety of languagesof languages Visual Basic, C++, JavaVisual Basic, C++, Java™™, Cobol, Pascal, Cobol, Pascal

COM components provide:COM components provide: Encapsulation of internal detailsEncapsulation of internal details Modularity for code reuseModularity for code reuse Intellectual Property SecurityIntellectual Property Security

Can be compiled and used from ASPCan be compiled and used from ASP Can be several times faster than ASPCan be several times faster than ASP

Building A COM Component Building A COM Component Visual Basic DemoVisual Basic Demo

ExAir Business LogicExAir Business Logic

How can we abstract the order How can we abstract the order processing elements of ExAir?processing elements of ExAir?

Two fundamental actions take placeTwo fundamental actions take place Order information must be updated Order information must be updated

in local ExAir Databasesin local ExAir Databases Remote subcontracting firm must be Remote subcontracting firm must be

informed of passenger’s food selectioninformed of passenger’s food selection

We’ll write two COM ComponentsWe’ll write two COM Components

ExAir Business Logic ExAir Business Logic

ExAir.OrderExAir.Order Calculate price of ticket; decrement user’s Calculate price of ticket; decrement user’s

balance in “Accounts” database tablebalance in “Accounts” database table Insert record into “Orders” tableInsert record into “Orders” table Subtract available seats in “Flights” tableSubtract available seats in “Flights” table

ExAir.FoodExAir.Food Insert record into “FoodPref” table owned Insert record into “FoodPref” table owned

by ExAir’s food service subcontractorby ExAir’s food service subcontractor

Public Sub BookFood( ByVal OrderID As Long, Public Sub BookFood( ByVal OrderID As Long,

ByVal FlightID As String, ByVal FlightID As String,

ByVal FoodPref As String )ByVal FoodPref As String )

‘ ‘ In the event of an error, jump to error handler In the event of an error, jump to error handler

On Error GoTo ErrorHandlerOn Error GoTo ErrorHandler

Dim adoConn As New ADODB.ConnectionDim adoConn As New ADODB.Connection

Dim adoCmd As New ADODB.CommandDim adoCmd As New ADODB.Command

‘ ‘ Open ADO Database ConnectionOpen ADO Database Connection

adoConn.Open (”ExAirFoodContractor")adoConn.Open (”ExAirFoodContractor")

adoCmd.ActiveConnection = adoConnadoCmd.ActiveConnection = adoConn

ExAir.FoodExAir.Food

adoCmd.CommandText adoCmd.CommandText

= = "INSERT into FoodPref (OrderID, "INSERT into FoodPref (OrderID,

FlightID, FoodType) FlightID, FoodType) Values Values (OrderID, FlightID, (OrderID, FlightID, FoodPref)”FoodPref)”

‘ ‘ Execute SQL CommandExecute SQL Command

adoCmd.ExecuteadoCmd.Execute

Exit SubExit Sub

ErrorHandler:ErrorHandler:

Err.Raise Number:=911, Source:=”ExAir.Food", Err.Raise Number:=911, Source:=”ExAir.Food", Description:=Err.DescriptionDescription:=Err.Description

End SubEnd Sub

ExAir.FoodExAir.Food

<% @ Language=JScript %><% @ Language=JScript %>

<%<%

var objOrder = Server.CreateObject(“ExAir.Order”);var objOrder = Server.CreateObject(“ExAir.Order”);

var objFood = Server.CreateObject(“ExAir.Food”);var objFood = Server.CreateObject(“ExAir.Food”);

orderID = objOrder.BookFlight( Session(“USER”),orderID = objOrder.BookFlight( Session(“USER”),

Request.QueryString(“Flight”),Request.QueryString(“Flight”),

Request.QueryString(“Num”),Request.QueryString(“Num”),

Request.QueryString(“Class”) );Request.QueryString(“Class”) );

objFood.BookFood( orderID, Request.QueryString(“Flight”),objFood.BookFood( orderID, Request.QueryString(“Flight”),

Request.QueryString(“FoodPref”) );Request.QueryString(“FoodPref”) );

%>%>

ExAir Submit.aspExAir Submit.asp

Transaction ServicesTransaction Services

There is a major problem with our There is a major problem with our application - what if there is a failure?application - what if there is a failure?

How do we coordinate updates across How do we coordinate updates across multiple data sources from multiple multiple data sources from multiple vendors? How do we roll vendors? How do we roll back changes?back changes?

How do we resolve concurrency, How do we resolve concurrency, deadlock, and atomicity between deadlock, and atomicity between multiple clients and servers?multiple clients and servers?

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Non-Transacted OrderNon-Transacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Non-Transacted OrderNon-Transacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Non-Transacted OrderNon-Transacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Non-Transacted OrderNon-Transacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Non-Transacted OrderNon-Transacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

System failure!System failure!

Non-Transacted OrderNon-Transacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Non-Transacted OrderNon-Transacted Order

Transaction ServicesTransaction Services

MTS provides required infrastructure MTS provides required infrastructure Units of work --> single atomic entityUnits of work --> single atomic entity All work commits or all work rolls backAll work commits or all work rolls back

Two-phase commit with remote serversTwo-phase commit with remote servers SQL ServerSQL Server™™, Oracle, DB2, Informix, MSMQ, Oracle, DB2, Informix, MSMQ

Built into Internet Information Server 4.0 Built into Internet Information Server 4.0 with Transacted ASPwith Transacted ASP Link between the Web and MTSLink between the Web and MTS

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

System failure!System failure!

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

TXTX

Transacted OrderTransacted Order

AccountsAccounts

OrdersOrders

FlightsFlights

Food preferenceFood preference

ExAir.OrderExAir.Order

ExAir.FoodExAir.Food

Submit.aspSubmit.asp

Transacted OrderTransacted Order

On Error GoTo ErrorHandlerOn Error GoTo ErrorHandler

Dim adoConn As New ADODB.ConnectionDim adoConn As New ADODB.Connection

Dim adoCmd As New ADODB.CommandDim adoCmd As New ADODB.Command

Dim ctxObjectDim ctxObject As ObjectContextAs ObjectContext

Set ctxObject = GetObjectContextSet ctxObject = GetObjectContext

adoConn.Open (" ExAirFoodContractor ")adoConn.Open (" ExAirFoodContractor ")

adoCmd.ActiveConnection = adoConnadoCmd.ActiveConnection = adoConn

adoCmd.CommandText = "INSERT into FoodPref (OrderID, FlightID, adoCmd.CommandText = "INSERT into FoodPref (OrderID, FlightID, FoodType) FoodType)

Values Values (OrderID, (OrderID, FlightID, FlightID, FoodPref)”FoodPref)”

ExAir.Food (Transacted)ExAir.Food (Transacted)

' Execute SQL Command' Execute SQL Command

adoCmd.ExecuteadoCmd.Execute

' If everything worked, mark as successful and exit' If everything worked, mark as successful and exit

ctxObject.SetCompletectxObject.SetComplete

Exit SubExit Sub

ErrorHandler:ErrorHandler:

‘ ‘ If failure, abort transactionIf failure, abort transaction

ctxObject.SetAbortctxObject.SetAbort

Err.Raise Number:=911, Source:="ExAir.Food", Err.Raise Number:=911, Source:="ExAir.Food", Description:=Err.DescriptionDescription:=Err.Description

ExAir.Food (Transacted)ExAir.Food (Transacted)

<%@ <%@ TRANSACTION=RequiredTRANSACTION=Required Language=JScript %> Language=JScript %>

<% <%

var objOrder = Server.CreateObject(“ExAir.Order”);var objOrder = Server.CreateObject(“ExAir.Order”);

var objFood = Server.CreateObject(“ExAir.Food”);var objFood = Server.CreateObject(“ExAir.Food”);

orderID = objOrder.BookFlight( Session(“USER”),orderID = objOrder.BookFlight( Session(“USER”),

Request.QueryString(“Flight”),Request.QueryString(“Flight”),

Request.QueryString(“Num”),Request.QueryString(“Num”),

Request.QueryString(“Class”) );Request.QueryString(“Class”) );

objFood.BookFood ( orderID, Request.QueryString(“Flight”),objFood.BookFood ( orderID, Request.QueryString(“Flight”),

Request.QueryString(“FoodPref”) );Request.QueryString(“FoodPref”) );

%>%>

Submit.asp (Transacted)Submit.asp (Transacted)

<%<%// If the Transaction Committed, ASP will call this Event Handler// If the Transaction Committed, ASP will call this Event Handlerfunction OnTransactionCommit()function OnTransactionCommit(){{

Response.Clear();Response.Clear();Response.Redirect(“Success.asp”);Response.Redirect(“Success.asp”);

}}

// If the Transaction Aborted, ASP will call this Event Handler// If the Transaction Aborted, ASP will call this Event Handlerfunction OnTransactionAbort()function OnTransactionAbort(){{

Response.Clear();Response.Clear();Response.Redirect(“Failure.asp”);Response.Redirect(“Failure.asp”);

}}%>%>

Submit.asp (Transacted)Submit.asp (Transacted)

Message QueuingMessage Queuing

Notifying the remote food subcontractor is Notifying the remote food subcontractor is currently done using a database insertcurrently done using a database insert

This causes several problemsThis causes several problems Network failures will cause order abortNetwork failures will cause order abort Latency will kill scalabilityLatency will kill scalability

Does the subcontractor notification have Does the subcontractor notification have to be synchronous?to be synchronous? What about the transaction model?What about the transaction model? How can we guarantee that the food contractor How can we guarantee that the food contractor

will eventually be notified?will eventually be notified?

Message QueuingMessage Queuing

Applications are not directly connectedApplications are not directly connected Communicate through queued messagesCommunicate through queued messages

Reliable queues survive application, Reliable queues survive application, system, and network failuressystem, and network failures Messages will queue until network Messages will queue until network

connectivity is restoredconnectivity is restored

MSMQ can participate in MSMQ can participate in MTS transactionsMTS transactions MSMQ will MSMQ will guaranteeguarantee that a message that a message

will be delivered (once and only once) will be delivered (once and only once) when a transaction commitswhen a transaction commits

Message QueuingMessage Queuing

Ideal for “time-independent” workIdeal for “time-independent” work Eliminates “resource shortage” errorsEliminates “resource shortage” errors An alternative to long-lock hold timesAn alternative to long-lock hold times

Synchronous versus Deferred IntegritySynchronous versus Deferred Integrity Business policy needs to determine Business policy needs to determine

how workflow progresseshow workflow progresses

What about deferred problems?What about deferred problems? Requires application-level undo Requires application-level undo

of a prior committed transactionof a prior committed transaction Consider how banks handle bad checksConsider how banks handle bad checks

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

BrowserBrowserIn

tern

et

Info

rma

tio

nIn

tern

et

Info

rma

tio

nS

erv

er

an

d A

SP

Se

rve

r a

nd

AS

P

MTSMTS

SQL ServerSQL Server

MSMQMSMQC

ompo

nent

s

Com

pone

nts

Exploration AirlinesExploration Airlines

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

TX 1TX 1

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

TX 1TX 1

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

TX 1TX 1

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

TX 1TX 1

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

TX 1TX 1

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood appTX 2TX 2

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood appTX 2TX 2

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood appTX 2TX 2

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

TX 2TX 2

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

Exploration AirlinesExploration Airlines

BrowserBrowser

SQL ServerSQL Server

MSMQMSMQInte

rne

t In

form

ati

on

Inte

rne

t In

form

ati

on

Se

rve

r a

nd

AS

PS

erv

er

an

d A

SP

MTSMTSC

ompo

nent

s

Com

pone

nts

Remote SQLRemote SQL MSMQMSMQ

Food appFood app

On Error GoTo ErrorHandlerOn Error GoTo ErrorHandler

Dim infoSnd Dim infoSnd As New MSMQQueueInfoAs New MSMQQueueInfo

Dim infoRespDim infoResp As New MSMQQueueInfoAs New MSMQQueueInfo

Dim queryDim query As New MSMQQueryAs New MSMQQuery

Dim Msg Dim Msg As New MSMQMessageAs New MSMQMessage

Dim qSend Dim qSend As MSMQQueueAs MSMQQueue

Dim ctxObject As ObjectContext Dim ctxObject As ObjectContext

Set ctxObject = GetObjectContextSet ctxObject = GetObjectContext

‘ ‘ Open Destination Queue (* using explicit queue name)Open Destination Queue (* using explicit queue name)

qinfoSend.PathName = ”FoodContractor\ExAirFoodPref"qinfoSend.PathName = ”FoodContractor\ExAirFoodPref"

Set qSend = infoSnd .Open (MQ_SEND_ACCESS, MQ_DENY_NONE)Set qSend = infoSnd .Open (MQ_SEND_ACCESS, MQ_DENY_NONE)

ExAir.Food (MSMQ)ExAir.Food (MSMQ)

' Construct Message' Construct Message

Msg.Label = “ExAir Food Order”Msg.Label = “ExAir Food Order”

Msg.Body = Str(OrderID) & ”;" & FlightID & “;” & FoodPrefMsg.Body = Str(OrderID) & ”;" & FlightID & “;” & FoodPref

‘ ‘ Set EncryptionSet Encryption

Msg.PrivLevel = MQMSG_PRIV_LEVEL_BODYMsg.PrivLevel = MQMSG_PRIV_LEVEL_BODY

‘ ‘ Use Lookup Response Queue (* using DS instead of explicit name)Use Lookup Response Queue (* using DS instead of explicit name)

Set qInfos = query.LookupQueue(Label := “Food Response”) Set qInfos = query.LookupQueue(Label := “Food Response”)

qInfos.ResetqInfos.Reset

Set infoResp = qInfos.NextSet infoResp = qInfos.Next

‘ ‘ Identify App Specific Response QueueIdentify App Specific Response Queue

Set Msg.ResponseQueueInfo = infoRespSet Msg.ResponseQueueInfo = infoResp

ExAir.Food (MSMQ)ExAir.Food (MSMQ)

‘ ‘ Send Message to Remote QueueSend Message to Remote Queue

Msg.Send qSend, MQ_MTS_TRANSACTIONMsg.Send qSend, MQ_MTS_TRANSACTION

‘ ‘ Close queueClose queue

qSend.CloseqSend.Close

‘ ‘ If everything succeeded, mark as successful and exitIf everything succeeded, mark as successful and exit

ctxObject.SetCompletectxObject.SetComplete

Exit SubExit Sub

ErrorHandler:ErrorHandler:

‘ ‘ If error occurred, abort transactionIf error occurred, abort transaction

ctxObject.SetAbortctxObject.SetAbort

ExAir.Food (MSMQ)ExAir.Food (MSMQ)

Exploration Airlines Exploration Airlines Using MSMQ Using MSMQ

How Do We Know It Scales?How Do We Know It Scales?

Don’t wait until deployment Don’t wait until deployment to worry about scalability - by then to worry about scalability - by then it maybe too late!it maybe too late!

Stress test during development Stress test during development WebCat - utility on the Internet Information WebCat - utility on the Internet Information

Server resource kitServer resource kit WebLoad - very good third party utilityWebLoad - very good third party utility

A Web application’s scalability is A Web application’s scalability is bounded by its weakest linkbounded by its weakest link Stress, examine, optimize…then repeatStress, examine, optimize…then repeat

Call To ActionCall To Action

Install the Install the Windows NTWindows NT®® 4.0 Option Pack 4.0 Option Pack Start building simple components Start building simple components

in the language of your choosingin the language of your choosing

Begin a pilot Windows DNA applicationBegin a pilot Windows DNA application Write killer DNA applicationWrite killer DNA application


Recommended