Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Service Broker / June 2006

Tip: Looking for answers? Try searching our database.

Design question with SQL Service Broker - External Activation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ramiro Calderón Romero - 28 Jun 2006 23:55 GMT
Hi,

In my current project is suitable for a messaging scenario so we decided to
use SQL Broker to handle it. I chose External Activation, since the actual
message processing has some complex logic and besides that I don't want to
have too much stress under SQL CLR Host. I'd already seen the
ExternalActivator sample which basically creates new OS proccesses as long
as a QUEUE_ACTIVATION notifications are received; I want to have an external
Wi ndows Service that receives the notification but I'd prefer some kind of
In-Process components that would deal with the underlying logic.

My proposed solution is to use a COM+ component with Object Pooling enabled
so I will be able to control the maximum number of instances (queue
processors for all intents and purposes) are instanced in any given time.

In addition I plan to use the Enterprise Library for deal with all issues
regarding error handling, caching, etc. that I would eventually need.

Is this a valid approach or should I use out-of-process message handling
just like the ExternalActivator Sample?

Thanks in advance for any advice,

Ramiro
Roger Wolter[MSFT] - 29 Jun 2006 07:00 GMT
I would tend to use the .net thread pool if you want to stay inproc.  I
think you will get better performance.  When you get a message on the event
queue, start a thread that receives messages in a loop until the queue is
empty.  If this doesn't make sense in your environment, please give us some
more information about what you're trying to do.

You might also want to think about whether your environment needs to use
activation at all.  If the message arrival rate is relatively constant, you
can start a fixed number of threads and avoid the complexity of activation.
Activation makes sense if you have large peaks and something else to do with
the processor when there are no messages arriving.  If you are running your
queue readers on a different machine, there may not be a big advantage to
using activation because when there are no messages on the queue the machine
with the queue readers doesn't have anything to do anyway.

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> Hi,
>
[quoted text clipped - 24 lines]
>
> Ramiro
Ramiro Calderón Romero - 29 Jun 2006 14:24 GMT
Hi Roger,

Thanks for your answer. Actually our scenario is like a payment request hub:
different business application sends payment and billing requests which are
sended to the hub using SQL Service Broker, so it is likey to expect a
constant load in the hub service during business hours, with some eventual
peaks
specially during weekends and/or special discounts seasons. The payment hub
in turn perform some auditing, and business rules processing and finally
it delivers the petition to an specialized payment system (i.e. Credit Card,
Check, Deposit) using SQL Service broker; those specialized systems
are "published" in the Payment service in a "plug-in" approach using a
common .NET interface and based on COM+ Server Application to ensure
transactionality.. What do you think of this approach?

If I understand correctly, your suggestion is to raise some queue listeners
with .NET built-in thread pool, every one running a message loop
(Service.Run), right? In such
case, is the conversation-locking feature working the same way that in the
internal activation? I mean, with such approach I can ensure that a
conversation
is just being serviced by one queue - reader?

Thanks,

Ramiro.

>I would tend to use the .net thread pool if you want to stay inproc.  I
>think you will get better performance.  When you get a message on the event
[quoted text clipped - 43 lines]
>>
>> Ramiro
Roger Wolter[MSFT] - 29 Jun 2006 15:41 GMT
Conversation locking it totally independent of activation.  I'm not sure I
understand the COM+ transaction statement you made.  In a Service Broker
application the message loop has to control transactions so that message
processing stays transactionally consistent.  something like COM+ automatic
transactions may interfere with the control and at best be a waste of time.
The .Net transactions support works a lot better in non-distributed
transaction situations.

I'd like to find out more about your application.  It sounds like an
interesting application of Service Broker.  Take the online out of my email
address if you want to reply directly.

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> Hi Roger,
>
[quoted text clipped - 74 lines]
>>>
>>> Ramiro
Ramiro Calderón Romero - 29 Jun 2006 21:50 GMT
Hi Roger,

My application is pretty much an integration one. Today, our customer has a
lot of business application which in turn use some payment transactions with
different payment methods such as credit card (visa and mastercard), cash,
checks, deposits, etc. some of this payment services/business applications
are built in house, some are purchased, some others are hosted externally
and are implemented in different techonological platforms (say web services,
flat files, SQL Server databases, etc.).

Business applications have some logic to handle those payment requests, in a
very thigtly couple approach with all its the inherent issues of
maintenance, consistency, etc.

Our main goal is to centralize all that logic in a Payment Hub Service in
such a way that business applications inside the company just have a single
point to access all the payment request despite the method used; our second
goal is to allow to include some other payment provider by means of
configuration rather than programming. This is when all the messaging
strategy comes in; we have to deal with scenarios in which some payment
service is down, when some payment service is too slow to respond but some
"working" response should be returned to the caller, resilient messaging,
retries, handle duplicate messages, queing the requests to a payment service
since it is in maintenance, etc.; we found SQL Service Broker a good way to
implement those features.

We are considering using COM+ server applications just as facades to the
actual payment subsystem because it will allow us an out of process hosting
as well as distributed transaction consistency, since such subsystem are
mainly existing applications with their own repository.

Regards,

Ramiro

> Conversation locking it totally independent of activation.  I'm not sure I
> understand the COM+ transaction statement you made.  In a Service Broker
[quoted text clipped - 87 lines]
>>>>
>>>> Ramiro
Ramiro Calderón Romero - 29 Jun 2006 22:06 GMT
Hi Roger,

I greatly appreciate your interest.

Our application is pretty much an Application-To-Application integration one
in a SOA approach. At this moment, our customer has serveral line of
business applications which generate payment transactions with different
payment methods such as credit card (visa/mastercard), cash, checks,
deposits, etc.

Some of this payment services/business applications are built in-house, some
are purchased, some others are hosted externally (i.e. visa and mastercard)
and expose different ways to communicate each other (say web services, flat
files, SQL Server databases, etc.) and had been implemented using different
tools (.NET 1.1, Visual Basic 6.0, etc.)

Each business application has code to communicate with each payment method,
in a very tightly couple approach with all its the inherent issues of
maintenance, consistency, etc.

Our main goal is to centralize all that logic in a Payment Hub Service in
such a way that business applications inside the company just have a single
point to access all the payment request despite the method used; our second
goal is to allow to include some other payment provider by means of
configuration/metadata rather than programming. This is when all the
messaging strategy comes in; we have to deal with scenarios such as:
1. some payment  service is down
2. some payment service is too slow to respond but some "working on your
request" response should be returned to the caller to avoid undesired
timeout errors in the business application
3. resilient messaging
4. retries
5. handle duplicate messages
6. queuing the requests to a payment service due to maintenances activities,
etc.;

We found SQL Service Broker a useful to implement those features instead of
do them by hand in two scenarios:
1. Between the business applications and the payment hub service
2. Between the payment hub service and the payment sub-system.

We are considering using COM+ server applications just as facades to the
payment subsystems because that will allow us an out of process hosting
(even in different servers with DCOM), object pooling, and distributed
transaction support, since such subsystems are mainly existing applications
with their own repository.

Regards,

Ramiro

> Conversation locking it totally independent of activation.  I'm not sure I
> understand the COM+ transaction statement you made.  In a Service Broker
[quoted text clipped - 87 lines]
>>>>
>>>> Ramiro
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.