Skip to main content

Taskiq - FastStream

Tests status Package version downloads Supported Python versions GitHub FastStream


The current package is just a wrapper for FastStream objects to make them compatible with Taskiq library.

Supported Python versions: 3.10–3.15.

The main goal of it - provide FastStream with a great Taskiq tasks scheduling feature.

Installation

If you already have FastStream project to interact with your Message Broker, you can add scheduling to it by installing just a taskiq-faststream

pip install taskiq-faststream

If you starting with a clear project, you can specify taskiq-faststream broker by the following distributions:

pip install taskiq-faststream[rabbit]
# or
pip install taskiq-faststream[kafka]
# or
pip install taskiq-faststream[confluent]
# or
pip install taskiq-faststream[nats]
# or
pip install taskiq-faststream[redis]
# or
pip install taskiq-faststream[mqtt]

For OpenTelemetry distributed tracing support:

pip install taskiq-faststream[otel]

Usage

The package gives you two classes: AppWrapper and BrokerWrapper

These are just containers for the related FastStream objects to make them taskiq-compatible

To create scheduling tasks for your broker, just wrap it to BrokerWrapper and use it like a regular taskiq Broker.

# regular FastStream code
from faststream.nats import NatsBroker

broker = NatsBroker()

@broker.subscriber("test-subject")
async def handler(msg: str):
    print(msg)

# taskiq-faststream scheduling
from taskiq.schedule_sources import LabelScheduleSource
from taskiq_faststream import BrokerWrapper, StreamScheduler

# wrap FastStream object
taskiq_broker = BrokerWrapper(broker)

# create periodic task
taskiq_broker.task(
    message="Hi!",
    # If you are using RabbitBroker, then you need to replace subject with queue.
    # If you are using KafkaBroker, then you need to replace subject with topic.
    subject="test-subject",
    schedule=[{
        "cron": "* * * * *",
    }],
)

# create scheduler object
scheduler = StreamScheduler(
    broker=taskiq_broker,
    sources=[LabelScheduleSource(taskiq_broker)],
)

To run the scheduler, just use the following command

taskiq scheduler module:scheduler

Also, you can wrap your FastStream application the same way (allows to use lifespan events and AsyncAPI documentation):

# regular FastStream code
from faststream import FastStream
from faststream.nats import NatsBroker

broker = NatsBroker()
app = FastStream(broker)

@broker.subscriber("test-subject")
async def handler(msg: str):
    print(msg)

# wrap FastStream object
from taskiq_faststream import AppWrapper
taskiq_broker = AppWrapper(app)

# Code below omitted 👇

A little feature: instead of using a final message argument, you can set a message callback to collect information right before sending:

async def collect_information_to_send():
    return "Message to send"

taskiq_broker.task(
    message=collect_information_to_send,
    ...,
)

Also, you can send a multiple message by one task call just using generator message callback with yield

async def collect_information_to_send():
    """Sends 10 messages per task call."""
    for i in range(10):
        yield i

taskiq_broker.task(
    message=collect_information_to_send,
    ...,
)

OpenTelemetry Support

taskiq-faststream supports taskiq's OpenTelemetry middleware. To enable it, pass OpenTelemetryMiddleware when creating the broker wrapper:

from faststream.nats import NatsBroker
from taskiq_faststream import BrokerWrapper
from taskiq.middlewares.otel_middleware import OpenTelemetryMiddleware

broker = NatsBroker()

# Enable OpenTelemetry middleware
taskiq_broker = BrokerWrapper(broker, middlewares=[OpenTelemetryMiddleware()])

This will automatically add OpenTelemetry middleware to track task execution, providing insights into:

  • Task execution spans
  • Task dependencies and call chains
  • Performance metrics
  • Error tracking

Make sure to configure your OpenTelemetry exporter (e.g., Jaeger, Zipkin) according to your monitoring setup.

The same applies to AppWrapper:

from faststream import FastStream
from taskiq_faststream import AppWrapper
from taskiq.middlewares.otel_middleware import OpenTelemetryMiddleware

app = FastStream(broker)

# Enable OpenTelemetry middleware
taskiq_broker = AppWrapper(app, middlewares=[OpenTelemetryMiddleware()])

Metadata

Release files for taskiq-faststream 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taskiq-faststream 0.4.3
File Size Uploaded Provenance Actions
taskiq_faststream-0.4.3.tar.gz 9.3 kB With provenance Details for taskiq_faststream-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for taskiq-faststream 0.4.3
File Interpreter ABI Platform Actions
taskiq_faststream-0.4.3-py3-none-any.whl Python 3 none any Details for taskiq_faststream-0.4.3-py3-none-any.whl

Total release size: 18.9 kB

Release files / taskiq_faststream-0.4.3.tar.gz

Download URL taskiq_faststream-0.4.3.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9e940c7c0f9a1c16e7291810b3efbd32bb80c0b1b7cd5dc8935f1775191ff59a
BLAKE2b-256 checksum
How to use checksums
f9e047882470be65f89c57c44f9c234ef69044c3f68f6c9b726685e5e9fef068
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / taskiq_faststream-0.4.3-py3-none-any.whl

Download URL taskiq_faststream-0.4.3-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4282eeb37b0dae67a7b3e6a588b644968f68ab76ad21a51d4b957e935cb8b2a
BLAKE2b-256 checksum
How to use checksums
2a2ab44d2a0f9275866cb6cc87e0a5bb5bef1a1690386b08938831ba57eebb42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for taskiq-faststream 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for taskiq_faststream-0.4.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page