How do I efficiently send notifications for different events to different users based on their preferences?

I’m creating a notification system for particular events.

A user can set the criteria that match particular events (ie. New item, changed item, closed item etc) Items have different characteristics (ie. Minor, Major, Critical). So a user may set up a search for All New Critical Items.

What is the most efficient way to identify the ones that match the users’ saved searches and send notifications to them every time an event happens?

One way would be to run ALL the saved searches for all users, every time an event happens and see which items are in those search results and send notifications.

The problem with this method I see is that it is inefficient (saved searches could become quite a few) and the complexity of this algorithm is directly proportional to the number of searches.

Does anyone know how websites, such as property websites do it? They send out emails for new properties that match users’ searches.

I’m thinking of a way to map new events to users, given their search somehow without running all the searches.

4

We’re currently building a web service to solve problems like this (with very complex rules, including negative rules – things not happening). Unfortunately it’s in private beta right now and we’re capped on users. However, hopefully I can share the details on how to build a much simpler version (minus negation).

As you outlined as your data grows it will become very slow to run through all the saved searches in a traditional relational database. If I’ve read your question correctly your events should contain all the data about whether a notification should be fired or not. I would create a namespace like naming convention for events like ‘new-item:minor’, ‘new-item:critical’, ‘closed-item:major’. Use these namedspaced events as the keys in a key value store like redis with the value being what should happen if that event arrives.

When an item is saved, updated, destroyed etc. use an aggregator like statsd to push the namespaced event key to a log.

Then you’ll have a data collector like fluentd watching that log file and running a background worker whenever an event key is pushed in. The worker looks up the redis key and either finds nothing and does nothing or sends out the appropriate event.

That’s about it, if you change fluentd’s config file to check every second (I think the default is a minute) you can have near real-time event notifications.

First, classify your listeners. Second, classify your events. Then, match up events to listeners.

I’m going to assume that you don’t have a capability such as following a particular topic, since you didn’t mention it.

Classify your listeners by grouping them up into criteria groups. All listeners looking for “New” x “Major” events are in one group. All listeners looking for “New” x “Critical” events are in another group, with overlapping listeners as needed. You will end up with 9 groups, the cross product of action and severity.

When an event occurs, you use the cross product of action and severity to select one of the groups. All of the listeners in the group should receive a notification.

This will have the minimum number of lookups and comparisons, given that user changing their preferences is much rarer than new events happening.

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