Using NSEventSubmitBatchFlightEvents
Just started with Notification Services. I am trying to figure out how I can create an application that will monitor BizTalk Ports and log any problems in an Event table using notification Services to allow various administrators to subscribe to event notification.
As a test I modified the Flight Sample to invoke a stored procedure as its provider. I changed the APP file as follows and re-built the solution.
<
Providers>
<NonHostedProvider><ProviderName>SQLStoredProcedureEventProvider</ProviderName></NonHostedProvider></Providers>Then I call a Stored Procedure in SQL Analyser to get things going and to update my log table in the PostQuery so that the same event is not retrieved twice by setting the processed date.
Exec NSEventSubmitBatchFlightEvents
@ProviderName = 'SQLStoredProcedureEventProvider',
@EventsQuery = 'SELECT LeavingFrom, GoingTo, Carrier, Price, Conditions
FROM FlightEvent WHERE dtProcessed is NULL',
@PostQuery = 'UPDATE FlightEvent SET dtProcessed = Getdate()
WHERE dtProcessed is NULL'
This works great if the service is running and NS generates the email. But if the service is not running at the time I run the SP the Event gets loaded into the table but none of the notifications get generated.
I guess I had expected that when the service came back up it would process all events that came in while it was down.
Q: In order to get assured notification of passed events (events that occured while the Service was not running) do I have to setup more features such as
Q: I don't necessaryly want to wrap my Stored Procedure Call into a C# Assembly so that it can be Hosted but that looks like the onyl way to do this correctly, 2- have it run on a shceduled basis from NS and 3- Make sure it only runs if the Service is running. In such cases though how does the Service know to tell the Hosted Component to Shutdown when it gets a requirest to shutdown. Doesn't this make for an overly complex architecture?
THanks
...Ray
rgagne@ no Spam.Please .canada.com
[2997 byte] By [
RayG] at [2008-1-25]
Ray,
You are correct that the events you submit will only be processed when the NS service is running. While the service is not running, events can accumulate in the table and will be processed when the service starts up again. You can control how far back in time the service will go in processing old events via the SubscriptionQuantumLimit and ChronicleQuantumLimit settings in the ADF - see the NS Books Online for more information on these settings.
If you set the quantum limits to 0, the service will process all old events at startup - so you won't need to do any of the more complex solutions you described.
The NS architecture is designed such that the service is expected to be running most or all of the time. The application is considered to be down if the service is not running. In your scenario, is it expected that the service won't be running for significant periods of time?
-shyam
Thank you very much for the explanation.
follow-up: How can I use the PostQuery to mark (Update) Application Events (in my applcation's database as having been completed without having to pass the set of primary keys of the events that were submitted in the batch by the Event provider?
I'm also being asked if the e-mail address for the recipient can be passed from a table in the application database. I have responded that this defeats the purpose of the Subscriptions and that instead we should invoke the Subscription Classes from our application to create and manage subscriptions in NS. Do you agree and does my response make sense?
Thanks
...Ray