Technique To Prevent Duplicate Callbacks – 3rd Party Sends Multiple duplicate Callbacks To URL Within 4ms Causing Issues

I’m building an app which integrates with a 3rd party software. This 3rd party software sends out a “change notification” via a callback url to notify my app when to search for new data. This is great as it prevents unnecessary polling for data but unfortunately they seem to spam the callback URL multiple times within a few milliseconds.

I can’t wrap my mind around how to prevent duplicating the actions taken by my app when it receives the callback.

The callback is something like this:

https://your_callback_url?connectionId=5fecbc200f0e4a7cbf41040e11047e56&ap
iKey=2de51c4fd0f04b9fabeb95225e87da70&type=Contact&id=3DC13A80-6EB1-4D3D-
B784-1B42BE325B7E&operation=Update

Specifically I’m looking for an “invoiced” type from the parameters and ignoring all others.

When my app receives a callback I do the following:

  • confirm parameters are received and type equals “invoiced”
  • make api request to 3rd party app to get the invoice info and corresponding customer info
  • Check if the invoice ID received by the callback already exists and, if not, create the invoice in my own database
  • create or update if exists the customer info in my own database
  • send an SMS message if a certain setting is enabled.

I was expecting the callback to be received, which would allow me to keep both customers and invoices in sync with the 3rd party app at all times without having to poll for data constantly. This does work however i’m receiving errors from the database because it’s attempting to create the same record multiple times.

I’ve tried the following:

  • check if the invoice exists first before performing any other actions then ending the function if it does. This doesn’t work because the callbacks are too close together (4ms in some cases) and so the first callback can’t complete the post to the database (50ms) before the second checks for the record (4ms)

  • Stupidly, I tried adding a time out in various places in the function to try and allow time for any previous callbacks to finish but all this did was push the whole process out by the duration of the timeout. Didn’t help at all.

  • Tried creating a callback monitoring database in which every callback is tracked by posting a record of it to a database. Then later in the function checking that there’s only 1 and ignoring any duplicates. This seemed really clunky and unnecessary, doesn’t work 100% as I found the odd invoice would get skipped completely which isn’t acceptable.

There has to be some simple way to deal with this?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Technique To Prevent Duplicate Callbacks – 3rd Party Sends Multiple duplicate Callbacks To URL Within 4ms Causing Issues

I’m building an app which integrates with a 3rd party software. This 3rd party software sends out a “change notification” via a callback url to notify my app when to search for new data. This is great as it prevents unnecessary polling for data but unfortunately they seem to spam the callback URL multiple times within a few milliseconds.

I can’t wrap my mind around how to prevent duplicating the actions taken by my app when it receives the callback.

The callback is something like this:

https://your_callback_url?connectionId=5fecbc200f0e4a7cbf41040e11047e56&ap
iKey=2de51c4fd0f04b9fabeb95225e87da70&type=Contact&id=3DC13A80-6EB1-4D3D-
B784-1B42BE325B7E&operation=Update

Specifically I’m looking for an “invoiced” type from the parameters and ignoring all others.

When my app receives a callback I do the following:

  • confirm parameters are received and type equals “invoiced”
  • make api request to 3rd party app to get the invoice info and corresponding customer info
  • Check if the invoice ID received by the callback already exists and, if not, create the invoice in my own database
  • create or update if exists the customer info in my own database
  • send an SMS message if a certain setting is enabled.

I was expecting the callback to be received, which would allow me to keep both customers and invoices in sync with the 3rd party app at all times without having to poll for data constantly. This does work however i’m receiving errors from the database because it’s attempting to create the same record multiple times.

I’ve tried the following:

  • check if the invoice exists first before performing any other actions then ending the function if it does. This doesn’t work because the callbacks are too close together (4ms in some cases) and so the first callback can’t complete the post to the database (50ms) before the second checks for the record (4ms)

  • Stupidly, I tried adding a time out in various places in the function to try and allow time for any previous callbacks to finish but all this did was push the whole process out by the duration of the timeout. Didn’t help at all.

  • Tried creating a callback monitoring database in which every callback is tracked by posting a record of it to a database. Then later in the function checking that there’s only 1 and ignoring any duplicates. This seemed really clunky and unnecessary, doesn’t work 100% as I found the odd invoice would get skipped completely which isn’t acceptable.

There has to be some simple way to deal with this?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật