Exemplo n.º 1
0
    def __init__(self, routing_key, func, name=None, config='config.py'):

        self.config = config_loader(config)
        self.routing_key = routing_key.upper()
        self.callback = func

        if not name:
            self.name = self._gen_name(self.callback)
        else:
            self.name = name

        self._cursor = S3Cursor(self.name,
                                type=self.config.s3_cursor['type'],
                                location=self.config.s3_cursor['location'])
Exemplo n.º 2
0
    def __init__( self, config='config.py', **kwargs ):
        """
        Create the producer.  General practive is to have a single routing_key for this producer,
        channel, connection.  This is for simplicity.  Multiple producers can be defined for the same
        routing key but are logically seperate in the code base.
        
        routing_key
            key for the data source to bind this producer to. Defaults to the config file.
        config
            Configuration file if not defined in muskrat.config.py.
        """
        self.config = config_loader( config )

        self.routing_key = kwargs.get( 'routing_key' )
        if self.routing_key:
            self.routing_key = self.routing_key.upper()
Exemplo n.º 3
0
    def __init__(self, routing_key, func, name=None, config='config.py'):

        self.config = config_loader( config )
        self.routing_key = routing_key.upper()
        self.callback = func

        if not name:
            self.name = self._gen_name( self.callback )
        else:
            self.name = name

        self._cursor = S3Cursor( 
                           self.name, 
                           type=self.config.s3_cursor['type'],
                           location=self.config.s3_cursor['location']
                       )
Exemplo n.º 4
0
    def __init__(self, routing_key, func, name=None, config='config.py'):

        self.config = config_loader(config)
        self.s3conn = boto.connect_s3(self.config.s3_key,
                                      self.config.s3_secret)
        self.bucket = self.s3conn.get_bucket(self.config.s3_bucket)
        self.routing_key = routing_key.upper()
        self.callback = func

        if not name:
            self.name = self._gen_name(self.callback)
        else:
            self.name = name

        self._cursor = S3Cursor(self.name,
                                type=self.config.s3_cursor['type'],
                                location=self.config.s3_cursor['location'])
Exemplo n.º 5
0
    def __init__(self, routing_key, func, name=None, config='config.py'):

        self.config = config_loader( config )
        self.s3conn = boto.connect_s3( self.config.s3_key, self.config.s3_secret )
        self.bucket = self.s3conn.get_bucket( self.config.s3_bucket )
        self.routing_key = routing_key.upper()
        self.callback = func

        if not name:
            self.name = self._gen_name( self.callback )
        else:
            self.name = name

        self._cursor = S3Cursor( 
                           self.name, 
                           type=self.config.s3_cursor['type'],
                           location=self.config.s3_cursor['location']
                       )