Skip to content

Commit

Permalink
Merge branch 'main' of github.com:PasNA6713/Propan into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Jul 23, 2023
2 parents 76c6b26 + 847c6eb commit fd243da
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/docs/en/nats/2_publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ asyncio.run(pub())

The `publish` method accepts the following arguments:

* `message`: bytes | str | dict | Sequence[Any] | pydatic.BaseModel - message to send
* `message`: bytes | str | dict | Sequence[Any] | pydantic.BaseModel - message to send
* `subject`: str - *subject*, where the message will be sent.

## Message Parameters
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/en/nats/4_nats-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you need stricter restrictions, like:

You should use the **NATS JetStream** extension.

In fact, the **JetStream** extension is the same **NATS** with the addition a persistent layer above the file system. Therefore, all interfaces for publishing and consuming messages are similar to the refular **NATS** usage.
In fact, the **JetStream** extension is the same **NATS** with the addition a persistent layer above the file system. Therefore, all interfaces for publishing and consuming messages are similar to the regular **NATS** usage.

However, the **JetStream** layer has many possibilities for configuration: from the deleting old messages policy to the maximum stored messages number limit. You can find out more about all **JetStream** features in the official [documentation](https://docs.nats.io/using-nats/developer/develop_jetstream ){.external-link target="_blank"}.

Expand All @@ -21,7 +21,7 @@ However, the **JetStream** layer has many possibilities for configuration: from

When connecting a `consumer` (and, especially, when reconnecting), you must determine for yourself, according to what logic it will consume messages: from the subject beginning, starting with some message, starting from some time, only new ones, etc. Don't be surprised if a connection is restored, your `consumer` starts to process all messages received earlier again - you haven't defined the rule.

Also **NATS JetStream** has built-in `key-value` (close to **Redis**) and `object` (close to **Minio**) storages, which, in addition to interface *put/get* have the ability to subscribe to events, which can be extremely useful in vary scenarios.
Also **NATS JetStream** has built-in `key-value` (close to **Redis**) and `object` (close to **Minio**) storages, which, in addition to interface *put/get* have the ability to subscribe to events, which can be extremely useful in various scenarios.

**Propan** does not provide access to this functionality directly, but it is covered by the [nats-py] library used({{urls.nats_py }}){target="_blank"}. You can access the **JS** object from the application context:

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/en/rabbit/4_publishing.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Rabbit Publishing

`RabbitBroker` also uses the unified `publish` method to send messages.
However, in this case, an object of the `aio_pika.Message` class (if necessary) can act as a message (in addition to `str`, `bytes`, `dict`, `pydatic.BaseModel`).
However, in this case, an object of the `aio_pika.Message` class (if necessary) can act as a message (in addition to `str`, `bytes`, `dict`, `pydantic.BaseModel`).

```python
import asyncio
from propan import RabbitBroker

async def pub():
async with RabbitBroker() as broker:
await broker.publish("Hi!", queue="test", exhcange="test")
await broker.publish("Hi!", queue="test", exchange="test")

asyncio.run(pub())
```
Expand All @@ -18,7 +18,7 @@ asyncio.run(pub())

The `publish` method takes the following arguments:

* `message`: bytes | str | dict | Sequence[Any] | pydatic.BaseModel | aio_pika.Message = "" - message to send
* `message`: bytes | str | dict | Sequence[Any] | pydantic.BaseModel | aio_pika.Message = "" - message to send
* `exchange`: str | RabbitExchange | None = None - the exchange where the message will be sent to. If not specified - *default* is used
* `queue`: str | RabbitQueue = "" - the queue where the message will be sent (since most queues use their name as the routing key, this is a human-readable version of `routing_key`)
* `routing_key`: str = "" - also a message routing key, if not specified, the `queue` argument is used
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/en/redis/2_publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ asyncio.run(pub())

The `publish` method accepts the following arguments:

* `message`: bytes | str | dict | Sequence[Any] | pydatic.BaseModel - message to send
* `message`: bytes | str | dict | Sequence[Any] | pydantic.BaseModel - message to send
* `channel`: str = "" - *channel* to which the message will be sent.

## Message Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/ru/nats/2_publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ asyncio.run(pub())

Метод `publish` принимает следующие аргументы:

* `message`: bytes | str | dict | Sequence[Any] | pydatic.BaseModel - сообщение для отправки
* `message`: bytes | str | dict | Sequence[Any] | pydantic.BaseModel - сообщение для отправки
* `subject`: str - *subject*, куда будет отправлено сообщение.

## Параметры сообщения
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/ru/rabbit/4_publishing.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Rabbit Publishing

Для отправки сообщений `RabbitBroker` также использует унифицированный метод `publish`.
Однако, в данном случае в качестве сообщения (помимо `str`, `bytes`, `dict`, `pydatic.BaseModel`) может выступать объект класса `aio_pika.Message` (при необходимости).
Однако, в данном случае в качестве сообщения (помимо `str`, `bytes`, `dict`, `pydantic.BaseModel`) может выступать объект класса `aio_pika.Message` (при необходимости).

```python
import asyncio
from propan import RabbitBroker

async def pub():
async with RabbitBroker() as broker:
await broker.publish("Hi!", queue="test", exhcange="test")
await broker.publish("Hi!", queue="test", exchange="test")

asyncio.run(pub())
```
Expand All @@ -18,7 +18,7 @@ asyncio.run(pub())

Метод `publish` принимает следующие аргументы:

* `message`: bytes | str | dict | Sequence[Any] | pydatic.BaseModel | aio_pika.Message = "" - сообщение для отправки
* `message`: bytes | str | dict | Sequence[Any] | pydantic.BaseModel | aio_pika.Message = "" - сообщение для отправки
* `exchange`: str | RabbitExchange | None = None - exchange, куда будет отправлено сообщение. Если не указан - используется *default*
* `queue`: str | RabbitQueue = "" - очередь, куда будет отправлено сообщение (т.к. большинство очередей используют свое название в качестве ключа маршрутизации, это человекочитаемый вариант `routing_key`)
* `routing_key`: str = "" - тоже ключ маршрутизации сообщения, если не указан - используется аргумент `queue`
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/ru/redis/2_publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ asyncio.run(pub())

Метод `publish` принимает следующие аргументы:

* `message`: bytes | str | dict | Sequence[Any] | pydatic.BaseModel - сообщение для отправки
* `message`: bytes | str | dict | Sequence[Any] | pydantic.BaseModel - сообщение для отправки
* `channel`: str = "" - *channel*, куда будет отправлено сообщение.

## Параметры сообщения
Expand Down
2 changes: 1 addition & 1 deletion docs/docs_src/nats/js.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async def example(js: NatsJS):
assert (await storage.get("hello")) == b"propan!"

# JS Object Storage
storage = await js.create_object_sotre("propan-obs")
storage = await js.create_object_store("propan-obs")

obj_name = "file.mp4"
with open(obj_name) as f:
Expand Down

0 comments on commit fd243da

Please sign in to comment.