def init(self, url, timeout=1, max_retries=5, emit_format='csv'):
     IEmitter.init(self, url,
                   timeout=timeout,
                   max_retries=max_retries,
                   emit_format=emit_format)
     if emit_format != 'csv':
         raise EmitterUnsupportedFormat('Not supported: %s' % emit_format)
 def init(self, url, timeout=1, max_retries=5, emit_format='csv'):
     IEmitter.init(self, url,
                   timeout=timeout,
                   max_retries=max_retries,
                   emit_format=emit_format)
     if emit_format == 'json':
         self.emit_per_line = True
 def init(self, url, timeout=1, max_retries=5, emit_format='csv'):
     IEmitter.init(self, url,
                   timeout=timeout,
                   max_retries=max_retries,
                   emit_format=emit_format)
     if emit_format == 'json':
         self.emit_per_line = True
 def init(self, url, timeout=1, max_retries=5, emit_format='csv'):
     IEmitter.init(self,
                   url,
                   timeout=timeout,
                   max_retries=max_retries,
                   emit_format=emit_format)
     if emit_format != 'csv':
         raise EmitterUnsupportedFormat('Not supported: %s' % emit_format)
Beispiel #5
0
    def init(self, url, timeout=1, max_retries=10, emit_format='csv'):
        IEmitter.init(self, url,
                      timeout=timeout,
                      max_retries=max_retries,
                      emit_format=emit_format)

        if emit_format == 'json':
            self.emit_per_line = True

        try:
            broker, topic = url[len('kafka://'):].split('/')
        except (KeyError, TypeError) as exc:
            logger.warn('Can not parse the url provided.')
            raise exc

        self.client = None
        self.producer = None

        call_with_retries(self.connect_to_broker,
                          max_retries=self.max_retries,
                          _args=tuple((broker, topic)))