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

sql server notification services

group:

NS API


NS API Wayne
8/9/2005 9:02:57 AM
sql server notification services:
I'm trying to updated subscriptions for a single subscriber, so far all is
working well. However, I was wondering is there a way to pull back just the
sing subscriber? Currently I am doing the following:

new SubscriberEnumeration(nsInstance)[subscriberId];

As I understand from the help the new SubscriberEnumeration(nsInstance)
creates a collection that contains all the subscribers in the database. This
seems to be a bit inefficient, I'd like to just retrieve the subscriber
based on the subscriberId.

--
Thanks
Wayne Sepega
Jacksonville, Fl

Enterprise Library Configuration Console Module Generator
http://workspaces.gotdotnet.com/elccmg

"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

Re: NS API Joe Webb
8/10/2005 9:25:14 AM
Hi Wayne -

The only property that you can really maintain for a subscriber is the
enabled property. BOL has an example of how to do that.

The following code retrieves the subscriptions for a single subscriber
without having to first retrieve the subscriber. Note, that this does
*not* populate the Subscriber object so a subsequent evaluation of the
Enabled property will be inaccurate (it'll show the default value of
true regardless of the actual state of the subscriber).

private SubscriptionEnumeration GetSubscriptions(string sId)
{
//Create an NSInstance and NSApplication object
NSInstance instance = getNSInstance();
NSApplication app = getNSApplication(instance);

//create a subscriber object
Subscriber subscriber = new Subscriber(instance);
subscriber.SubscriberId = sId;

//get the SubscriptionClassName
string subClass = "mySubscriptionName";

//get the subscriptions
return subscriber.GetSubscriptions(app, subClass);

}


HTH... Let me know if I've misinterpreted your post.

--
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 Tue, 9 Aug 2005 09:02:57 -0400, "Wayne" <MeNotYou@community.nospam>
[quoted text, click to view]
Re: NS API Wayne
8/11/2005 10:21:59 AM
That's closer to what I was looking for, what I really need is the
following:

1) how to retrieve a single subscriber
I have the subscriber ID
2) how to retrieve a single subscription
I have the subscription ID

Thanks
Wayne


[quoted text, click to view]

Re: NS API kate
8/11/2005 2:53:36 PM
we have not come across a simple named method for getting a
subscription by id, given the way NS is envisaged i dont think they saw
it as necessary. You can enumerate the subscriptions for the subscriber
and then select from the enum. However, we have had some problem with
this enum when retreiving the date fields for a subscriber.

to get a subscriber by id, again there isnt a named method , you have
to enumerate all the subscribers and then you can select from the enum
by id.

hope that helps

Kate MBCS

Alert Technologies
http://www.alert-technologies.co.uk
Get your notification services implementation going in minutes not
weeks ......
Re: NS API Wayne
8/11/2005 3:37:31 PM
Also meant to mention we are using SQL 2005 June CTP.

Thanks
Wayne


[quoted text, click to view]

Re: NS API Wayne
8/12/2005 12:00:00 AM
and does the subscription work the same? or for that matter any of the
enumerations?


[quoted text, click to view]

Re: NS API Wayne
8/12/2005 8:10:02 AM
Ok, the subscription I could understand, not like but understand, but no way
to get a subscriber? We have the potential for have a very large subscriber
base, and with what you stated below I would have to be pulling back all the
subscribers from the database into memory to get one subscriber. Just seems
REALLY inefficient to me.

Where can I send an email to MS to suggest something be added to address
this?


[quoted text, click to view]

Re: NS API Shyam Pather [MSFT]
8/12/2005 11:19:46 AM
Wayne,
Just creating a SubscriberEnumeration does not actually read all the
subscriber data into memory. The enumeration is populated lazily, meaning
the data isn't fetched until you ask for it. When you request a single
subscriber by ID, we go to the database and fetch just that single
subscriber.

So though it looks as if you have to read everything into memory, the
implementation takes care of doing things more efficiently.
-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: NS API kate
8/12/2005 2:20:42 PM
useful bit of info about the 'lazy' read.
thanks Shyam

Kate MBCS

Alert Technologies
http://www.alert-technologies.co.uk
Get your notification services implementation going in minutes not
weeks ......
Re: NS API Andy
9/6/2005 1:30:45 PM
How do you do the lazy read, if that is not a trade secret. I just have not
heard of doing this in applications and would like to know how it is
accomplished.

Thanks.

[quoted text, click to view]

AddThis Social Bookmark Button