Developer forum

Forum » CMS - Standard features » Triggering Saved subscriber for an user / address only once

Triggering Saved subscriber for an user / address only once

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

We ran into a situation with Live Integration where we have multiple UserSaved / AddressSaved notifications fire for a user, causing multiple requests to the ERP per HTTP context. For example:

  • Changing user data triggers 1 notification - UserSaved
  • Adding a new address (without setting it as the default) triggers 2 notifications - UserSaved + UserAddress
  • Changing the default address triggers 3 notifications - UserSaved + UserAddress (old default address) + UserAddress (new default address)

Since the XML for a user also includes the address info, we're sending the same information multiple times. When the requests fire fast enough, this can lead to duplicate data in the ERP.

Ideally, I like to have a single notification subscriber like AllUserDataSaved that I can handle to submit the data to the ERP. Would that be possible somehow?

If not, I was thinking about doing this custom, as follows:

1. Handle UserSaved and just add something to HttpContext.Current.Items to indicate there's a pending change
2. Do the same for UserAddressSaved
3. In a late subscriber like OnOutput or so, fire a custom notification like AllUserDataSaved 
4. Handle AllUserDataSaved and send all data to the ERP.

Would that be a good approach? Any pitfalls I need to be aware of?

Thanks!

Imar


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump Any ideas on how to improve saving addresses?

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
while (!GetResponse())
{
  Bump();
}

 

You must be logged in to post in the forum