Skip to content

Commit

Permalink
minor fixes and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pepellsd committed Dec 23, 2024
1 parent de07299 commit a7af883
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 26 deletions.
6 changes: 4 additions & 2 deletions docs/docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ search:
- [TelemetrySettingsProvider](public_api/faststream/opentelemetry/TelemetrySettingsProvider.md)
- rabbit
- [ExchangeType](public_api/faststream/rabbit/ExchangeType.md)
- [QueueType](public_api/faststream/rabbit/QueueType.md)
- [RabbitBroker](public_api/faststream/rabbit/RabbitBroker.md)
- [RabbitExchange](public_api/faststream/rabbit/RabbitExchange.md)
- [RabbitPublisher](public_api/faststream/rabbit/RabbitPublisher.md)
Expand Down Expand Up @@ -872,6 +873,7 @@ search:
- [PublishingStatus](api/faststream/prometheus/types/PublishingStatus.md)
- rabbit
- [ExchangeType](api/faststream/rabbit/ExchangeType.md)
- [QueueType](api/faststream/rabbit/QueueType.md)
- [RabbitBroker](api/faststream/rabbit/RabbitBroker.md)
- [RabbitExchange](api/faststream/rabbit/RabbitExchange.md)
- [RabbitPublisher](api/faststream/rabbit/RabbitPublisher.md)
Expand Down Expand Up @@ -932,9 +934,9 @@ search:
- schemas
- [BaseRMQInformation](api/faststream/rabbit/schemas/BaseRMQInformation.md)
- [ExchangeType](api/faststream/rabbit/schemas/ExchangeType.md)
- [QueueType](api/faststream/rabbit/schemas/QueueType.md)
- [RabbitExchange](api/faststream/rabbit/schemas/RabbitExchange.md)
- [RabbitQueue](api/faststream/rabbit/schemas/RabbitQueue.md)
- [RabbitQueueType](api/faststream/rabbit/schemas/RabbitQueueType.md)
- [ReplyConfig](api/faststream/rabbit/schemas/ReplyConfig.md)
- constants
- [ExchangeType](api/faststream/rabbit/schemas/constants/ExchangeType.md)
Expand All @@ -948,9 +950,9 @@ search:
- [QueueClassicTypeSpecificArgs](api/faststream/rabbit/schemas/queue/QueueClassicTypeSpecificArgs.md)
- [QueueQuorumTypeSpecificArgs](api/faststream/rabbit/schemas/queue/QueueQuorumTypeSpecificArgs.md)
- [QueueStreamTypeSpecificArgs](api/faststream/rabbit/schemas/queue/QueueStreamTypeSpecificArgs.md)
- [QueueType](api/faststream/rabbit/schemas/queue/QueueType.md)
- [QuorumQueueArgs](api/faststream/rabbit/schemas/queue/QuorumQueueArgs.md)
- [RabbitQueue](api/faststream/rabbit/schemas/queue/RabbitQueue.md)
- [RabbitQueueType](api/faststream/rabbit/schemas/queue/RabbitQueueType.md)
- [SharedQueueClassicAndQuorumArgs](api/faststream/rabbit/schemas/queue/SharedQueueClassicAndQuorumArgs.md)
- [StreamQueueArgs](api/faststream/rabbit/schemas/queue/StreamQueueArgs.md)
- reply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ search:
boost: 0.5
---

::: faststream.rabbit.schemas.RabbitQueueType
::: faststream.rabbit.QueueType
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ search:
boost: 0.5
---

::: faststream.rabbit.schemas.queue.RabbitQueueType
::: faststream.rabbit.schemas.QueueType
11 changes: 11 additions & 0 deletions docs/docs/en/api/faststream/rabbit/schemas/queue/QueueType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# 0.5 - API
# 2 - Release
# 3 - Contributing
# 5 - Template Page
# 10 - Default
search:
boost: 0.5
---

::: faststream.rabbit.schemas.queue.QueueType
6 changes: 2 additions & 4 deletions docs/docs_src/rabbit/subscription/stream.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from faststream import FastStream, Logger
from faststream.rabbit import RabbitBroker, RabbitQueue
from faststream.rabbit import RabbitBroker, RabbitQueue, QueueType

broker = RabbitBroker(max_consumers=10)
app = FastStream(broker)

queue = RabbitQueue(
name="test-stream",
durable=True,
arguments={
"x-queue-type": "stream",
},
queue_type=QueueType.STREAM
)


Expand Down
2 changes: 2 additions & 0 deletions faststream/rabbit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from faststream.rabbit.router import RabbitPublisher, RabbitRoute, RabbitRouter
from faststream.rabbit.schemas import (
ExchangeType,
QueueType,
RabbitExchange,
RabbitQueue,
ReplyConfig,
Expand All @@ -13,6 +14,7 @@

__all__ = (
"ExchangeType",
"QueueType",
"RabbitBroker",
"RabbitExchange",
# Annotations
Expand Down
4 changes: 2 additions & 2 deletions faststream/rabbit/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from faststream.rabbit.schemas.constants import ExchangeType
from faststream.rabbit.schemas.exchange import RabbitExchange
from faststream.rabbit.schemas.proto import BaseRMQInformation
from faststream.rabbit.schemas.queue import RabbitQueue, RabbitQueueType
from faststream.rabbit.schemas.queue import QueueType, RabbitQueue
from faststream.rabbit.schemas.reply import ReplyConfig

__all__ = (
"RABBIT_REPLY",
"BaseRMQInformation",
"ExchangeType",
"QueueType",
"RabbitExchange",
"RabbitQueue",
"RabbitQueueType",
"ReplyConfig",
)

Expand Down
30 changes: 14 additions & 16 deletions faststream/rabbit/schemas/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from faststream.types import AnyDict


class RabbitQueueType(Enum):
Classic = "classic"
Quorum = "quorum"
Stream = "stream"
class QueueType(str, Enum):
CLASSIC = "classic"
QUORUM = "quorum"
STREAM = "stream"


CommonQueueArgs = TypedDict(
Expand All @@ -23,7 +23,7 @@ class RabbitQueueType(Enum):
"x-queue-leader-locator": Literal["client-local", "balanced"],
"x-max-length-bytes": int,
},
total=True,
total=False,
)

SharedQueueClassicAndQuorumArgs = TypedDict(
Expand All @@ -36,7 +36,7 @@ class RabbitQueueType(Enum):
"x-dead-letter-routing-key": str,
"x-max-length": int,
},
total=True,
total=False,
)


Expand All @@ -46,7 +46,7 @@ class RabbitQueueType(Enum):
"x-overflow": Literal["drop-head", "reject-publish", "reject-publish-dlx"],
"x-max-priority": int,
},
total=True,
total=False,
)

QueueQuorumTypeSpecificArgs = TypedDict(
Expand All @@ -58,7 +58,7 @@ class RabbitQueueType(Enum):
"x-quorum-target-group-size": int,
"x-dead-letter-strategy": Literal["at-most-once", "at-least-once"],
},
total=True,
total=False,
)


Expand All @@ -70,7 +70,7 @@ class RabbitQueueType(Enum):
"x-stream-filter-size-bytes": int,
"x-initial-cluster-size": int,
},
total=True,
total=False,
)


Expand Down Expand Up @@ -131,7 +131,7 @@ def routing(self) -> str:
def __init__(
self,
name: str,
queue_type: Literal[RabbitQueueType.Classic] = RabbitQueueType.Classic,
queue_type: Literal[QueueType.CLASSIC] = QueueType.CLASSIC,
durable: Literal[True, False] = False,
exclusive: bool = False,
passive: bool = False,
Expand All @@ -147,7 +147,7 @@ def __init__(
def __init__(
self,
name: str,
queue_type: Literal[RabbitQueueType.Quorum],
queue_type: Literal[QueueType.QUORUM],
durable: Literal[True],
exclusive: bool = False,
passive: bool = False,
Expand All @@ -163,7 +163,7 @@ def __init__(
def __init__(
self,
name: str,
queue_type: Literal[RabbitQueueType.Stream],
queue_type: Literal[QueueType.STREAM],
durable: Literal[True],
exclusive: bool = False,
passive: bool = False,
Expand All @@ -178,15 +178,13 @@ def __init__(
def __init__(
self,
name: str,
queue_type: Literal[
RabbitQueueType.Quorum, RabbitQueueType.Classic, RabbitQueueType.Stream
] = RabbitQueueType.Classic,
queue_type: QueueType = QueueType.CLASSIC,
durable: Literal[True, False] = False,
exclusive: bool = False,
passive: bool = False,
auto_delete: bool = False,
arguments: Optional[
Union[QuorumQueueArgs, ClassicQueueArgs, StreamQueueArgs]
Union[QuorumQueueArgs, ClassicQueueArgs, StreamQueueArgs, "AnyDict"]
] = None,
timeout: "TimeoutType" = None,
robust: bool = True,
Expand Down

0 comments on commit a7af883

Please sign in to comment.