all groups > sql server notification services > june 2005 >
You're in the

sql server notification services

group:

NotificationBatchId


NotificationBatchId SVA
6/27/2005 4:52:15 AM
sql server notification services:
I wonder if anyone could shed some light on the following problem:

I would like to log information about notification batches in my app
database.

1.
In particular, I would like to obtain Batch Notification Id in my
custom content formatter. Is it possible? (Batch Notification Id is
stored in the NS...NotificationsNotificationBatches1 table).

Is batch notification id available by the time content formatter is
called?

2.
Is it possible to run custom SQL command when Notification Batch is
generated, in order to write associated data about notification batch
to my database?

I have not found any relevant information on this subject in SQL Server
Notification Services documentation.

Thank you.
Re: NotificationBatchId Shyam Pather [MSFT]
6/27/2005 1:11:58 PM
Hello
The NotificationBatchId is not exposed through any of the public interfaces.
It's intended more as an internal identifier. Can you describe more about
what you're trying to do? There may be another way to accomplish it.
Thanks
-shyam

--
Learn more about SQL-NS:
http://www.amazon.com/exec/obidos/tg/detail/-/0672326647/
---------------------------------------------
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.
---------------------------------------------
[quoted text, click to view]

Re: NotificationBatchId Joe Webb
6/27/2005 4:30:48 PM
What do you want to log that's not built-in to SQLNS?

Look up "logging level values" and logging notification delivery
information" in BOLto see some of the capabilities that are built-in
to the product.


HTH...

--
Joe Webb
SQL Server MVP


~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811

I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)



On 27 Jun 2005 04:52:15 -0700, "SVA" <uspexpress@unisoftplus.com>
[quoted text, click to view]
Re: NotificationBatchId SVA
6/28/2005 12:32:40 AM
Thank you Shyam and Joe.

Let me explain:

Let's assume there is a subscription linked with an event provider.
The event provider is scheduled to run weekly (or daily).

It means that the Event Provider runs once a week and collects new
event data.
After that, the system sends new alerts to susbscribers.
That is OK and it works fine.

In my application, I would like to:
1. Generate a report with Start/End times when the actual sendout took
place.

2. Gather some statistics linked to these "sendouts" rather than to the
subscription itself.
Examples of such statistics are:
a. "link tracking" feature for emails.
b. bounced emails statistics

For example, the "link tracking" feature could look as follows:
tracklink.aspx?notificationBatchId=xxx&URL=yyy

The links similar to the one shown above is generated in my custom
Content Formatter component.
So it means that I need to get access to NotificationBatchId in my
custom Content Formatter.

In case of bounced emails, I need to access NotificationBatchId in my
Custom Delivery Protocol.

(The statistics mentioned above is stored in my application database.)


So this is the reason as to why I'm looking into NotificationBatch Id.

Regards,
Vladislav
Re: NotificationBatchId Joe Webb
6/28/2005 2:53:37 PM
Hi SVA -

I've been playing around with your scenario for a few minutes now;
trying to get to the NotificationBatchId from the custom content
formatter. Here's what I'm thinking.

The formatter has access to all fields in the notification through the
hash table. So I can think of a couple of options:

1) Find a way to get the NotificationBatchId into the hash table
before the content formatter is called. For this scenario I've been
looking into creating a UDF that will get the NotificationBatchId for
the notification.

2) Within the content formatter, open a connection to the SQLNS
application database and look for the NotificationBatchId based on
what you know from the notification fields. Perhaps you'll have to
make a best guess (ie SELECT MAX(NotificationBatchId)) since it's
possible that multiple notifications with the exact same notification
data could exist from different batches. There may be some performance
issue here too.


HTH...




--
Joe Webb
SQL Server MVP


~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811

I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)


On 28 Jun 2005 00:32:40 -0700, "SVA" <uspexpress@unisoftplus.com>
[quoted text, click to view]
Re: NotificationBatchId SVA
6/30/2005 2:51:37 AM
Thank you Joe.

I have found a solution that is based on your idea #1.
The workaround is to create a dummy computed column so that it is
passed to the hashtable.

It looks as follows:
<NotificationClasses>
<NotificationClass>
<NotificationClassName>myClassName</NotificationClassName>
<Schema>
<ComputedFields>
<ComputedField>
<FieldName>nID</FieldName>
<SqlExpression>
N.NotificationId
</SqlExpression>
</ComputedField>
</ComputedFields>
....


The above sample applies to NotificationId column, but the same
approach can be used for the NotificationBatchId as well.

Perhaps NS team should consider adding an explicit support for the
NotificationID and NotificationBatchId fields in the FormatContent
method of the IContentFormatter interface.

Once again, thank you.

Regards,
Vladislav.
AddThis Social Bookmark Button