# Path: ethicsapplication/signals.py

# 
# Path: review/signals.py



from ethicsapplication.signals import application_created
from review.signals import application_accepted_by_reviewer,\
    application_rejected_by_reviewer
from django.conf import settings
import pika
import json
    
    '''
    
    connection = pika.BlockingConnection(pika.ConnectionParameters(
        host=host))
    channel = connection.channel()
    
    channel.exchange_declare(exchange=exchange_info[0],
                             exchange_type=exchange_info[1])
    
    
    channel.basic_publish(exchange=exchange_info[0],
                          routing_key=routing,
                          body=message)
    
    connection.close()
def lifecycle_event_handler(sender, **kwargs):
    '''
        This handler will send a message to a message queue
        with information about the lifecycle event.
        The mesage will only be sent if the settings.PUBLISH_LIFECYCLE 
        flag is set to True.
    '''
    
    host = settings.AMQP_HOST
    
    exchange_info = ('openethics_events', 'fanout')
    
    signal = kwargs['signal']
    

# Path: ethicsapplication/signals.py

# 
# Path: review/signals.py



# Path: publisher/signals.py
from ethicsapplication.signals import application_created
from review.signals import application_accepted_by_reviewer,\
    application_rejected_by_reviewer
from django.conf import settings
import pika
import json

    
    '''
    
    connection = pika.BlockingConnection(pika.ConnectionParameters(
        host=host))
    channel = connection.channel()
    
    channel.exchange_declare(exchange=exchange_info[0],
                             exchange_type=exchange_info[1])
    
    
    channel.basic_publish(exchange=exchange_info[0],
                          routing_key=routing,
                          body=message)
    
    connection.close()
def lifecycle_event_handler(sender, **kwargs):
    '''
        This handler will send a message to a message queue
        with information about the lifecycle event.
        The mesage will only be sent if the settings.PUBLISH_LIFECYCLE 
        flag is set to True.
    '''
    
    host = settings.AMQP_HOST
    
    exchange_info = ('openethics_events', 'fanout')
    
    signal = kwargs['signal']
    

    if signal == application_created: