MCPcopy
hub / github.com/Bogdanp/dramatiq / send_with_options

Method send_with_options

dramatiq/actor.py:152–179  ·  view source on GitHub ↗

Asynchronously send a message to this actor, along with an arbitrary set of processing options for the broker and middleware. Parameters: args(tuple): Positional arguments that are passed to the actor. kwargs(dict): Keyword arguments that are passed to th

(
        self,
        *,
        args: tuple = (),
        kwargs: Optional[dict[str, Any]] = None,
        delay: Optional[timedelta | int] = None,
        **options,
    )

Source from the content-addressed store, hash-verified

150 return self.send_with_options(args=args, kwargs=kwargs)
151
152 def send_with_options(
153 self,
154 *,
155 args: tuple = (),
156 kwargs: Optional[dict[str, Any]] = None,
157 delay: Optional[timedelta | int] = None,
158 **options,
159 ) -> Message[R]:
160 """Asynchronously send a message to this actor, along with an
161 arbitrary set of processing options for the broker and
162 middleware.
163
164 Parameters:
165 args(tuple): Positional arguments that are passed to the actor.
166 kwargs(dict): Keyword arguments that are passed to the actor.
167 delay(int): The minimum amount of time, in milliseconds, the
168 message should be delayed by. Also accepts a timedelta.
169 **options: Arbitrary options that are passed to the
170 broker and any registered middleware.
171
172 Returns:
173 Message: The enqueued message.
174 """
175 if isinstance(delay, timedelta):
176 delay = int(delay.total_seconds() * 1000)
177
178 message = self.message_with_options(args=args, kwargs=kwargs, **options)
179 return self.broker.enqueue(message, delay=delay)
180
181 def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R:
182 """Synchronously call this actor.

Calls 2

message_with_optionsMethod · 0.95
enqueueMethod · 0.45