예제 #1
0
파일: __init__.py 프로젝트: xpxu/celery
 def _get_queue_arguments(self, ttl=None, expires=None):
     conf = self.app.conf
     return dictfilter({
         'x-message-ttl':
         maybe_s_to_ms(ttl if ttl is not None else conf.event_queue_ttl, ),
         'x-expires':
         maybe_s_to_ms(
             expires
             if expires is not None else conf.event_queue_expires, ),
     })
예제 #2
0
파일: rpc.py 프로젝트: bryson/celery
 def __init__(
     self,
     app,
     connection=None,
     exchange=None,
     exchange_type=None,
     persistent=None,
     serializer=None,
     auto_delete=True,
     **kwargs
 ):
     super(BaseRPCBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self._out_of_band = {}
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(exchange, exchange_type, self.delivery_mode)
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({"x-expires": maybe_s_to_ms(self.expires)})
     self.result_consumer = self.ResultConsumer(
         self, self.app, self.accept, self._pending_results, self._pending_messages
     )
     if register_after_fork is not None:
         register_after_fork(self, _on_after_fork_cleanup_backend)
예제 #3
0
 def __init__(self,
              app,
              connection=None,
              exchange=None,
              exchange_type=None,
              persistent=None,
              serializer=None,
              auto_delete=True,
              **kwargs):
     deprecated.warn(
         'The AMQP result backend',
         deprecation='4.0',
         removal='5.0',
         alternative='Please use RPC backend or a persistent backend.')
     super(AMQPBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange,
         exchange_type,
         self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires':
         maybe_s_to_ms(self.expires),
     })
예제 #4
0
파일: amqp.py 프로젝트: bryson/celery
 def __init__(self, app, connection=None, exchange=None, exchange_type=None,
              persistent=None, serializer=None, auto_delete=True, **kwargs):
     deprecated.warn(
         'The AMQP result backend', deprecation='4.0', removal='5.0',
         alternative='Please use RPC backend or a persistent backend.')
     super(AMQPBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange, exchange_type, self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires': maybe_s_to_ms(self.expires),
     })
예제 #5
0
 def __init__(self,
              app,
              connection=None,
              exchange=None,
              exchange_type=None,
              persistent=None,
              serializer=None,
              auto_delete=True,
              **kwargs):
     super(BaseRPCBackend, self).__init__(app, **kwargs)
     conf = self.app.conf
     self._connection = connection
     self._out_of_band = {}
     self.persistent = self.prepare_persistent(persistent)
     self.delivery_mode = 2 if self.persistent else 1
     exchange = exchange or conf.result_exchange
     exchange_type = exchange_type or conf.result_exchange_type
     self.exchange = self._create_exchange(
         exchange,
         exchange_type,
         self.delivery_mode,
     )
     self.serializer = serializer or conf.result_serializer
     self.auto_delete = auto_delete
     self.queue_arguments = dictfilter({
         'x-expires':
         maybe_s_to_ms(self.expires),
     })
     self.result_consumer = self.ResultConsumer(
         self,
         self.app,
         self.accept,
         self._pending_results,
         self._pending_messages,
     )
     if register_after_fork is not None:
         register_after_fork(self, _on_after_fork_cleanup_backend)