developing-funboost-mixin

Create Consumer and Publisher Mixin classes to add cross-cutting concerns to funboost brokers.

892|166|Updated Dec 25, 2021
One-click install
npx skills add https://github.com/ydf0509/funboost --skill developing-funboost-mixin-ydf0509
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: developing-funboost-mixin
Source: https://github.com/ydf0509/funboost/tree/main/.agents/skills/developing-funboost-mixin
Command: npx skills add https://github.com/ydf0509/funboost --skill developing-funboost-mixin-ydf0509

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding monitoring, circuit breaking, rate limiting, or distributed tracing to funboost consumers normally requires modifying broker internals. This Skill guides you to build Mixin extension classes that intercept consumer and publisher methods via Python MRO, injecting cross-cutting logic without touching the framework core. ## Core Features & Use Cases - Consumer Mixin Templates: Override hooks like _submit_task, _run, and the three post-execution record hooks to add metrics, circuit breakers, and quota checks. - Publisher Mixin Support: Intercept _publish_impl and _after_publish to add publish-side logging and metrics. - Hook Selection Guidance: Explains which of the three post-execution hooks allows blocking IO, async IO, or CPU-only operations, preventing consumer slowdowns. - Use Case: You want Prometheus metrics and a circuit breaker on a Redis-backed queue. Write a Mixin combining CircuitBreakerConsumerMixin and PrometheusConsumerMixin, then pass it via consumer_override_cls in BoosterParams with namespaced user_options config. ## Quick Start Ask the AI to write a funboost Consumer Mixin that counts task failures and sends an alert when failures exceed a threshold, then wire it into a @boost decorated function.

Frequently Asked Questions about developing-funboost-mixin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add monitoring to a funboost consumer?▼

Create a Mixin class overriding `_both_sync_and_aio_frame_custom_record_process_info_func` for CPU-only counters, or `_frame_custom_record_process_info_func` for blocking IO like HTTP alerts. Pass the class via `consumer_override_cls` in `BoosterParams` and always call `super()` to preserve the chain.

How to implement a circuit breaker for funboost task consumers?▼

Use the existing `CircuitBreakerConsumerMixin` from `funboost/contrib/override_publisher_consumer_cls/`, or write your own Mixin overriding `_submit_task` to reject tasks when failure counts exceed a threshold. Configure thresholds through a namespaced key in `user_options`.

Can I combine multiple funboost mixins on one consumer?▼

Yes, define a class inheriting from multiple mixins such as `CircuitBreakerConsumerMixin` and `PrometheusConsumerMixin`. Python MRO chains their methods correctly as long as every mixin consistently calls `super()` in its overridden hooks.

Which funboost hook allows blocking IO operations?▼

Use `_frame_custom_record_process_info_func` for synchronous IO like database writes or HTTP calls, and `_aio_frame_custom_record_process_info_func` for async IO. Never perform IO in `_both_sync_and_aio_frame_custom_record_process_info_func`, which runs on the core dispatch path.

Why is my funboost mixin hook not being called?▼

Common causes are forgetting to call `super()`, which breaks the MRO chain, or only overriding `_run` while tasks execute asynchronously via `_async_run`. Ensure both sync and async paths are handled and the class is passed as `consumer_override_cls`.