MCPcopy
hub / github.com/celery/celery / publish

Method publish

celery/events/dispatcher.py:116–140  ·  view source on GitHub ↗

Publish event using custom :class:`~kombu.Producer`. Arguments: type (str): Event type name, with group separated by dash (`-`). fields: Dictionary of event fields, must be json serializable. producer (kombu.Producer): Producer instance to use:

(self, type, fields, producer,
                blind=False, Event=Event, **kwargs)

Source from the content-addressed store, hash-verified

114 callback()
115
116 def publish(self, type, fields, producer,
117 blind=False, Event=Event, **kwargs):
118 """Publish event using custom :class:`~kombu.Producer`.
119
120 Arguments:
121 type (str): Event type name, with group separated by dash (`-`).
122 fields: Dictionary of event fields, must be json serializable.
123 producer (kombu.Producer): Producer instance to use:
124 only the ``publish`` method will be called.
125 retry (bool): Retry in the event of connection failure.
126 retry_policy (Mapping): Map of custom retry policy options.
127 See :meth:`~kombu.Connection.ensure`.
128 blind (bool): Don't set logical clock value (also don't forward
129 the internal logical clock).
130 Event (Callable): Event type used to create event.
131 Defaults to :func:`Event`.
132 utcoffset (Callable): Function returning the current
133 utc offset in hours.
134 """
135 clock = None if blind else self.clock.forward()
136 event = Event(type, hostname=self.hostname, utcoffset=utcoffset(),
137 pid=self.pid, clock=clock, **fields)
138 with self.mutex:
139 return self._publish(event, producer,
140 routing_key=type.replace('-', '.'), **kwargs)
141
142 def _publish(self, event, producer, routing_key, retry=False,
143 retry_policy=None, utcoffset=utcoffset):

Callers 6

sendMethod · 0.95
republishFunction · 0.45
store_resultMethod · 0.45
_setMethod · 0.45
send_task_messageMethod · 0.45
_publishMethod · 0.45

Calls 4

_publishMethod · 0.95
utcoffsetFunction · 0.90
EventFunction · 0.85
replaceMethod · 0.45

Tested by

no test coverage detected