Friday, February 24, 2012

Getting Extra Notifications after Content Formatter completes!

Hi,

I am getting extra notifications which I am really not sure how and why its hapening.

I did try debugging, and everything seems perfect till ContentFormatter. I am getting exact number of messages for a

particular event and they are getting formatted perfectly by the custom content formatter.

But when I check the NS<ClassInstanceName>NotificationDistribution in the Notification DB, I have multiple records.

I did check the underlying query for this View and the issue is with NSDistributionLog. In some of these extra records I

can see the NotificationText that was never generated by the content formatter for this particular event.

We are supporting only one DeviceType 'Email' as of now.

Any suggestions/ideas why this is happening?

Hi Poonam -

Are you using any custom components?

Joe|||

Hi Joe,

Yes I have a custom content formatter in place and thanks for helping me on this.

But I have figured out the problem and posting it here for reference. Here is what was happening:

Notification Service Instance creates a Work Item for each Batch of notification. But the View

NS<ClassInstanceName>NotificationDistribution doesn't consider BatchIDs. Rather it considers only the NotificationIDs.

Notifications IDs can be repeated with in a Batch.

So this view returns the records (for all the batch ids) where there is a match in the NotificationID irrespective of the if this

Notification is part of the batch or not.

So here is the output:

You get correct no. of emails formatted from content formatter

Correct no and content is delivered to the Delivery Channel

But

When we see the NS<ClassInstanceName>NotificationDistribution, there are extra records with

Different NotificationText that was actually never related to this Event.

Below is the correct query with the reference to Batch ID of the notifications actually generated:

SELECT *

FROM [...].[NS<ClassInstanceName>Notifications] N WITH (READUNCOMMITTED)

JOIN [...].[NSDistributorWorkItems] DW WITH (NOLOCK)

ON N.NotificationBatchID = DW.BatchID

JOIN [...].[NSSubscriberDevices] SD WITH (READUNCOMMITTED)

ON SD.SubscriberId = N.SubscriberId

AND SD.DeviceName = N.DeviceName

JOIN [...].[NSDistributionLog] DL WITH (READUNCOMMITTED)

ON DL.NotificationId = N.NotificationId

AND DW.DistributorWorkItemID = DL.DistributorWorkItemID

JOIN [...].[NSDistributors] D WITH (READUNCOMMITTED)

ON D.DistributorId = DL.DistributorId

JOIN [...].[NSNotificationDeliveryStatusCodes] DSC WITH (READUNCOMMITTED)

ON DSC.NotificationDeliveryStatusCode = DL.DeliveryStatusCode

WHERE

DL.NotificationClassId = 1

[...] - are corresponding Schema Names.

No comments:

Post a Comment