예제 #1
0
class MessagingProducer(object):
    '''
    Base class for all integration class that will produce messages.

    All messaging awared integration app should inherit from this class.
    '''
    def __init__(self):
        self._producer = Producer()

    def send(self, msg, event_name, sync=True):
        ''' Begin to send message '''

        routing_key = '%s.%s' % (ROUTING_KEY_PREFIX, event_name)
        self._producer.send(msg, routing_key, sync)
예제 #2
0
파일: base.py 프로젝트: Aaln1986/Nitrate
class MessagingProducer(object):
    '''
    Base class for all integration class that will produce messages.

    All messaging awared integration app should inherit from this class.
    '''

    def __init__(self):
        self._producer = Producer()

    def send(self, msg, event_name, sync=True):
        ''' Begin to send message '''

        routing_key = '%s.%s' % (ROUTING_KEY_PREFIX, event_name)
        self._producer.send(msg, routing_key, sync)