Tổng Bài đăng:
207
Karma:
1245
Đã tham gia:
03/03/2016
Vị trí:
Denmark
Hi I am subscribing to the event that happpens when a product is saved. I need to call some external webservice, but i only need to do it once. It seems that my code is run 3 times for every time i save a product. This is my class: public class POSKachingEventConsumer : IConsumer<EntityUpdatedEvent<Core.Domain.Catalog.Product>> and this method gets called 3 times: public void HandleEvent(EntityUpdatedEvent<Core.Domain.Catalog.Product> eventMessage) Is that by design, and how can i prevent my code to run more than once per product being saved?
Tổng Bài đăng:
2
Karma:
10
Đã tham gia:
30/12/2018
Vị trí:
Nepal
Hi, Did you found any solution for this issue? I'm also facing similar issue. HandleEvent is hitting 3 times.
Các lập trình viên được chứng nhận
Tổng Bài đăng:
334
Karma:
3370
Đã tham gia:
28/12/2016
Vị trí:
India
it's call three time because in first call your product entity update, the two time call for SaveDiscountMappings() method. if you are doing changes from plugin then you can use action filter to call your external webservice based on productUpdate() action.
Tổng Bài đăng:
2
Karma:
10
Đã tham gia:
30/12/2018
Vị trí:
Nepal
Hi, I want to keep log from my plugin so I implemented HandleEvent whenever product is Added, Edited or Deleted from Admin. Event is hitting multiple times so what's the best practice to keep log only once. Please guide me on how to prevent this or how to do it in actionfilter?