def process_event(self, msg, headers): """ Callback method for the subscriber listening for all events """ #------------------------------------------------------------------------------------ # From the reverse user info dict find out which users have subscribed to that event #------------------------------------------------------------------------------------ user_ids = [] if self.reverse_user_info: user_ids = check_user_notification_interest( event=msg, reverse_user_info=self.reverse_user_info) #log.debug("Notification worker found interested users %s" % user_ids) #------------------------------------------------------------------------------------ # Send email to the users #------------------------------------------------------------------------------------ for user_id in user_ids: msg_recipient = self.user_info[user_id]['user_contact'].email self.smtp_client = setting_up_smtp_client() send_email(event=msg, msg_recipient=msg_recipient, smtp_client=self.smtp_client, rr_client=self.resource_registry) self.smtp_client.quit()
def process_event(self, msg, headers): """ Callback method for the subscriber listening for all events """ #------------------------------------------------------------------------------------ # From the reverse user info dict find out which users have subscribed to that event #------------------------------------------------------------------------------------ user_ids = [] if self.reverse_user_info: user_ids = check_user_notification_interest(event = msg, reverse_user_info = self.reverse_user_info) log.debug("Notification worker found interested users %s" % user_ids) #------------------------------------------------------------------------------------ # Send email to the users #------------------------------------------------------------------------------------ for user_id in user_ids: msg_recipient = self.user_info[user_id]['user_contact'].email self.smtp_client = setting_up_smtp_client() send_email(event=msg, msg_recipient=msg_recipient, smtp_client=self.smtp_client, rr_client=self.resource_registry) self.smtp_client.quit()
def callback(message, headers): """ This callback is given to all the event subscribers that this user wants notifications for. If this callback gets called the user in this processor should get an email """ # find the email address of the user user = self.rr.read(user_id) msg_recipient = user.contact.email # send email to the user send_email(message, msg_recipient, self.smtp_client)
def process_event(self, msg, headers): """ Callback method for the subscriber listening for all events """ # ------------------------------------------------------------------------------------ # From the reverse user info dict find out which users have subscribed to that event # ------------------------------------------------------------------------------------ users = [] if self.reverse_user_info: users = check_user_notification_interest(event=msg, reverse_user_info=self.reverse_user_info) log.info("Type of event received by notification worker: %s" % msg.type_) log.info("Notification worker deduced the following users were interested in the event: %s" % users) # ------------------------------------------------------------------------------------ # Send email to the users # ------------------------------------------------------------------------------------ for user_name in users: msg_recipient = self.user_info[user_name]["user_contact"].email send_email(message=msg, msg_recipient=msg_recipient, smtp_client=self.smtp_client)
def process_event(self, msg, headers): """ Callback method for the subscriber listening for all events """ #------------------------------------------------------------------------------------ # From the reverse user info dict find out which users have subscribed to that event #------------------------------------------------------------------------------------ user_ids = [] if self.reverse_user_info: log.debug("Notification worker checking for users interested in %s" % msg.type_) user_ids = check_user_notification_interest(event = msg, reverse_user_info = self.reverse_user_info) log.debug("Notification worker deduced the following users were interested in the event: %s, event_type: %s, origin: %s" % (user_ids, msg.type_, msg.origin )) #------------------------------------------------------------------------------------ # Send email to the users #------------------------------------------------------------------------------------ for user_id in user_ids: msg_recipient = self.user_info[user_id]['user_contact'].email self.smtp_client = setting_up_smtp_client() send_email(message = msg, msg_recipient = msg_recipient, smtp_client = self.smtp_client ) self.smtp_client.quit()