Skip to content

Commit 8a5cf7a

Browse files
author
DanielePalaia
committed
integrate qpid-proton lib
1 parent 9043c94 commit 8a5cf7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+16398
-185
lines changed

.github/workflows/build-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jobs:
3939
- name: poetry install
4040
run: poetry install --no-root
4141
- name: isort check-only
42-
run: poetry run isort --check-only .
42+
run: poetry run isort --skip rabbitmq_amqp_python_client/qpid --check-only .
4343
- name: black check
4444
run: poetry run black --check .
4545
- name: flake8
4646
run: poetry run flake8 --exclude=venv,local_tests,docs/examples --max-line-length=120 --ignore=E203,W503
4747
- name: mypy
4848
run: |
49-
poetry run mypy .
49+
poetry run mypy --exclude=rabbitmq_amqp_python_client/qpid .
5050
- name: poetry run pytest
5151
run: poetry run pytest

examples/getting_started/main.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,36 +21,34 @@ def main() -> None:
2121

2222
management.declare_exchange(ExchangeSpecification(name=exchange_name, arguments={}))
2323

24-
binding_exchange_queue_path = management.declare_queue(
24+
management.declare_queue(
2525
QueueSpecification(name=queue_name, queue_type=QueueType.quorum, arguments={})
2626
)
2727

28+
bind_name = management.bind(
29+
BindingSpecification(
30+
source_exchange=exchange_name,
31+
destination_queue=queue_name,
32+
binding_key=routing_key,
33+
)
34+
)
2835

29-
#management.bind(
30-
# BindingSpecification(
31-
# source_exchange=exchange_name,
32-
# destination_queue=queue_name,
33-
# binding_key=routing_key,
34-
# )
35-
#)
36-
37-
#addr = exchange_address(exchange_name, routing_key)
36+
addr = exchange_address(exchange_name, routing_key)
3837

39-
#publisher = connection.publisher(addr)
38+
publisher = connection.publisher(addr)
4039

41-
#publisher.publish(Message(body="test"))
40+
publisher.publish(Message(body="test"))
4241

43-
#publisher.close()
42+
publisher.close()
4443

45-
#management.unbind(binding_exchange_queue_path)
44+
management.unbind(bind_name)
4645

4746
# management.purge_queue(queue_info.name)
4847

4948
management.delete_queue(queue_name)
5049

5150
management.delete_exchange(exchange_name)
5251

53-
5452
management.close()
5553

5654
connection.close()

poetry.lock

Lines changed: 29 additions & 137 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ readme = "README.md"
88

99
[tool.poetry.dependencies]
1010
python = "^3.9"
11-
python-qpid-proton = "^0.39.0"
1211

1312
[tool.poetry.dev-dependencies]
1413
flake8 = "^7.1.1"
1514
isort = "^5.9.3"
1615
mypy = "^0.910"
1716
pytest = "^7.4.0"
1817
black = "^24.3.0"
19-
python-qpid-proton = "^0.39.0"
2018

2119
[build-system]
2220
requires = ["poetry-core"]

rabbitmq_amqp_python_client/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from importlib import metadata
22

3-
from proton import Message
4-
5-
from .address_helper import exchange_address
3+
from .address_helper import exchange_address, queue_address
64
from .common import QueueType
75
from .connection import Connection
86
from .entities import (
@@ -11,6 +9,7 @@
119
QueueSpecification,
1210
)
1311
from .publisher import Publisher
12+
from .qpid.proton._message import Message
1413

1514
try:
1615
__version__ = metadata.version(__package__)
@@ -29,5 +28,6 @@
2928
"QueueType",
3029
"Publisher",
3130
"exchange_address",
31+
"queue_address",
3232
"Message",
3333
]

rabbitmq_amqp_python_client/management.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
import uuid
33
from typing import Any, Optional
44

5-
from proton import Message
6-
from proton._data import Data
7-
from proton.utils import (
8-
BlockingConnection,
9-
BlockingReceiver,
10-
BlockingSender,
11-
)
12-
135
from .address_helper import (
146
binding_path_with_exchange_queue,
157
exchange_address,
@@ -24,6 +16,12 @@
2416
)
2517
from .exceptions import ValidationCodeException
2618
from .options import ReceiverOption, SenderOption
19+
from .qpid.proton._message import Message
20+
from .qpid.proton.utils import (
21+
BlockingConnection,
22+
BlockingReceiver,
23+
BlockingSender,
24+
)
2725

2826
logger = logging.getLogger(__name__)
2927

@@ -154,14 +152,13 @@ def delete_exchange(self, exchange_name: str) -> None:
154152
logger.debug("delete_exchange operation called")
155153
path = exchange_address(exchange_name)
156154

157-
print(path)
158-
159155
self.request(
160-
Data.NULL,
156+
None,
161157
path,
162158
CommonValues.command_delete.value,
163159
[
164160
CommonValues.response_code_200.value,
161+
CommonValues.response_code_204.value,
165162
],
166163
)
167164

@@ -175,6 +172,7 @@ def delete_queue(self, queue_name: str) -> None:
175172
CommonValues.command_delete.value,
176173
[
177174
CommonValues.response_code_200.value,
175+
CommonValues.response_code_204.value,
178176
],
179177
)
180178

@@ -226,6 +224,7 @@ def unbind(self, binding_exchange_queue_path: str) -> None:
226224
CommonValues.command_delete.value,
227225
[
228226
CommonValues.response_code_200.value,
227+
CommonValues.response_code_204.value,
229228
],
230229
)
231230

rabbitmq_amqp_python_client/options.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
from proton._data import PropertyDict, symbol # noqa: E402
2-
from proton._endpoints import Link # noqa: E402
3-
from proton.reactor import LinkOption # noqa: E402
1+
from .qpid.proton._data import ( # noqa: E402
2+
PropertyDict,
3+
symbol,
4+
)
5+
from .qpid.proton._endpoints import Link # noqa: E402
6+
from .qpid.proton.reactor import LinkOption # noqa: E402
47

58

69
class SenderOption(LinkOption): # type: ignore

rabbitmq_amqp_python_client/publisher.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import logging
22
from typing import Optional
33

4-
from proton import Message
5-
from proton.utils import (
4+
from .options import SenderOption
5+
from .qpid.proton._message import Message
6+
from .qpid.proton.utils import (
67
BlockingConnection,
78
BlockingReceiver,
89
BlockingSender,
910
)
1011

11-
from .options import SenderOption
12-
1312
logger = logging.getLogger(__name__)
1413

1514

@@ -22,7 +21,6 @@ def __init__(self, conn: BlockingConnection, addr: str):
2221
self._open()
2322

2423
def _open(self) -> None:
25-
print("addr is " + str(self._addr))
2624
if self._sender is None:
2725
logger.debug("Creating Sender")
2826
self._sender = self._create_sender(self._addr)

0 commit comments

Comments
 (0)