Enforce email check
This commit is contained in:
parent
f8ded2029d
commit
a654580b9e
2 changed files with 20 additions and 12 deletions
|
|
@ -12,14 +12,21 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def process_message(chan, method, properties, body):
|
||||
topic = method.routing_key
|
||||
data = json.loads(body)
|
||||
|
||||
if topic == 'mail.message':
|
||||
logger.info('new message => {}'.format(data))
|
||||
processor.enqueue({'request': 'new_mail', 'data': data})
|
||||
else:
|
||||
logger.warn('unsupported message [topic={}]'.format(topic))
|
||||
try:
|
||||
topic = method.routing_key
|
||||
data = json.loads(body)
|
||||
|
||||
if topic == 'mail.message':
|
||||
if "STACOSYS" in data['subject']:
|
||||
logger.info('new message => {}'.format(data))
|
||||
processor.enqueue({'request': 'new_mail', 'data': data})
|
||||
else:
|
||||
logger.info('ignore message => {}'.format(data))
|
||||
else:
|
||||
logger.warn('unsupported message [topic={}]'.format(topic))
|
||||
except:
|
||||
logger.exception('cannot process message')
|
||||
|
||||
|
||||
class MessageConsumer(Thread):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue