microsoft.public.sqlserver.notificationsvcs
[Top] [All Lists]

Re: Multiple devices for a subscription

Subject: Re: Multiple devices for a subscription
From: "Shyam Pather [MSFT]"
Date: Tue, 23 Aug 2005 11:28:22 -0700
Newsgroups: microsoft.public.sqlserver.notificationsvcs
Wayne,
This is actually quite simple to do. Remember that the match rule is just a 
join that produces the notification rows. Each row represents a notification 
going to one device. So if you want to have the same notification sent to 
multiple devices, you just need to write your match rule in such a way as to 
produce multiple rows with the same notification data, but different device 
names. Here's an example of one way to do it:

Keep a table that stores a mapping of subscriptions to devices. For example:

CREATE TABLE SubscriptionDeviceMappings
(
    SubscriptionId bigint,
    SubscriberId nvarchar(255),
    DeviceName nvarchar(255)
)

In your match rule, you simply join like this:

SELECT ....
FROM Events e, Subscriptions s
            JOIN SubscriptionDeviceMappings m where m.SubscriptionId = 
s.SubscriptionId
WHERE ...

If the SubscriptionDeviceMappings table has multiple rows for each 
SubscriptionId, you'll end up with multiple notification rows.

You'll have to maintain the SubscriptionDeviceMappings table in your 
subscription management code, but that's really not different to keeping the 
device name in the subscription itself, which is a very common practice.

Hope this helps.
-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.
---------------------------------------------
"Wayne" <[email protected]> wrote in message 
news:eEkTon%[email protected]
> We have a need to send events out to multiple devices for a single 
> subscription, the user may be able to decide what devices with what 
> subscriptions. So far we have the following two ideas for accomplishing 
> this:
>
> create a multiple subscriptions, one for each device the user wants the 
> events to go to
>
> create a multiple unique device entries for each subscription
>
>
>
> So far as I've been able to tell there is no transaction support when 
> using the notification services API, so having to update multiple records 
> for a single subscription can lead to further maintenance issues if the 
> updating were to fail part way through.
>
> Is there a simpler way to have events for a single subscription to go out 
> to multiple devices?
>
>
> -- 
> 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
>
> 



<Prev in Thread] Current Thread [Next in Thread>