amqp-client-python 0.1.13__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- amqp_client_python/__init__.py +1 -0
- amqp_client_python/domain/models/config.py +40 -4
- amqp_client_python/domain/models/options.py +35 -3
- amqp_client_python/domain/models/ssl_options.py +16 -0
- amqp_client_python/domain/utils/__init__.py +2 -0
- amqp_client_python/domain/utils/connection_type.py +8 -0
- amqp_client_python/domain/utils/types.py +7 -0
- amqp_client_python/event/__init__.py +4 -0
- amqp_client_python/event/async_provider_handler.py +9 -0
- amqp_client_python/event/async_subscriber_handler.py +9 -0
- amqp_client_python/event/event.py +6 -0
- amqp_client_python/event/provider_handler.py +9 -0
- amqp_client_python/event/subscriber_handler.py +9 -0
- amqp_client_python/exceptions/auto_reconnect_exception.py +2 -2
- amqp_client_python/exceptions/blocking_exception.py +3 -3
- amqp_client_python/exceptions/eventbus_exception.py +3 -3
- amqp_client_python/exceptions/nack_exception.py +2 -2
- amqp_client_python/exceptions/publish_timeout_exception.py +2 -2
- amqp_client_python/exceptions/response_timeout_exception.py +2 -2
- amqp_client_python/exceptions/rpc_provider_exception.py +3 -3
- amqp_client_python/exceptions/thread_unsafe_exception.py +3 -3
- amqp_client_python/exceptions/timeout_exception.py +2 -2
- amqp_client_python/py.typed +0 -0
- amqp_client_python/rabbitmq/__init__.py +1 -1
- amqp_client_python/rabbitmq/async_channel.py +149 -100
- amqp_client_python/rabbitmq/async_channel_factory.py +6 -1
- amqp_client_python/rabbitmq/async_connection.py +47 -46
- amqp_client_python/rabbitmq/async_connection_factory.py +4 -3
- amqp_client_python/rabbitmq/async_eventbus_rabbitmq.py +215 -41
- amqp_client_python/rabbitmq/channel_factory_rabbitmq.py +3 -1
- amqp_client_python/rabbitmq/channel_rabbitmq.py +32 -21
- amqp_client_python/rabbitmq/connection_factory_rabbitmq.py +4 -3
- amqp_client_python/rabbitmq/connection_rabbitmq.py +18 -12
- amqp_client_python/rabbitmq/eventbus_rabbitmq.py +32 -12
- amqp_client_python/rabbitmq/eventbus_wrapper_rabbitmq.py +63 -29
- amqp_client_python/rabbitmq/ioloop_factory.py +3 -2
- amqp_client_python/signals.py +42 -0
- {amqp_client_python-0.1.13.dist-info → amqp_client_python-0.2.0.dist-info}/METADATA +71 -58
- amqp_client_python-0.2.0.dist-info/RECORD +45 -0
- {amqp_client_python-0.1.13.dist-info → amqp_client_python-0.2.0.dist-info}/WHEEL +1 -1
- amqp_client_python-0.1.13.dist-info/RECORD +0 -35
- {amqp_client_python-0.1.13.dist-info → amqp_client_python-0.2.0.dist-info}/LICENSE +0 -0
amqp_client_python/__init__.py
CHANGED
|
@@ -9,22 +9,58 @@ class Config:
|
|
|
9
9
|
def __init__(
|
|
10
10
|
self, options: Options, ssl_options: Optional[SSLOptions] = None
|
|
11
11
|
) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Create an Config object thats hold and mount the connection information.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
options: hold information for estabilish connection
|
|
17
|
+
ssl_options: hold information for estabilish SSL connections
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
|
|
21
|
+
Raises:
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
>>> Config(
|
|
25
|
+
Options("example", "example.rpc", "example.rpc", "amqp://admin:admin@localhost:5672/"),
|
|
26
|
+
SSLOptions("./.certs/cert.pem", "./.certs/privkey.pem", "./.certs/ca.pem")
|
|
27
|
+
)
|
|
28
|
+
"""
|
|
12
29
|
self.url = None
|
|
13
30
|
self.options = options
|
|
14
31
|
self.ssl_options = ssl_options
|
|
15
32
|
|
|
16
|
-
def build(self):
|
|
33
|
+
def build(self) -> "Config":
|
|
34
|
+
"""
|
|
35
|
+
Create an Config object thats hold and mount the connection information.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
Config object
|
|
41
|
+
|
|
42
|
+
Raises:
|
|
43
|
+
|
|
44
|
+
Examples:
|
|
45
|
+
>>> config.build()
|
|
46
|
+
"""
|
|
17
47
|
opt = {
|
|
18
48
|
**self.options.kwargs,
|
|
19
49
|
"heartbeat": self.options.heartbeat,
|
|
20
50
|
}
|
|
21
|
-
if
|
|
51
|
+
if self.ssl_options is not None:
|
|
52
|
+
protocol = "amqps"
|
|
53
|
+
if self.options.port is None:
|
|
54
|
+
self.options.port = 5671
|
|
22
55
|
opt["ssl_options"] = {
|
|
23
|
-
"certfile": self.ssl_options.certfile_path,
|
|
24
56
|
"keyfile": self.ssl_options.keyfile_path,
|
|
57
|
+
"certfile": self.ssl_options.certfile_path,
|
|
25
58
|
"ca_certs": self.ssl_options.ca_certs_path,
|
|
26
59
|
}
|
|
27
|
-
|
|
60
|
+
else:
|
|
61
|
+
protocol = "amqp"
|
|
62
|
+
if self.options.port is None:
|
|
63
|
+
self.options.port = 5672
|
|
28
64
|
if self.options.uri:
|
|
29
65
|
url = "{}?{} ".format(self.options.uri, urlencode(opt))
|
|
30
66
|
else:
|
|
@@ -7,16 +7,48 @@ class Options:
|
|
|
7
7
|
queue_name: str,
|
|
8
8
|
rpc_queue_name: str,
|
|
9
9
|
rpc_exchange_name: str,
|
|
10
|
-
uri: str = None,
|
|
10
|
+
uri: Optional[str] = None,
|
|
11
11
|
login: str = "guest",
|
|
12
12
|
passwd: str = "guest",
|
|
13
13
|
domain: str = "localhost",
|
|
14
|
-
port: int =
|
|
14
|
+
port: Optional[int] = None,
|
|
15
15
|
vhost: str = "/",
|
|
16
16
|
heartbeat: Optional[int] = 60,
|
|
17
|
-
publisher_confirms=False,
|
|
17
|
+
publisher_confirms: bool = False,
|
|
18
18
|
**kwargs: Dict[str, Any]
|
|
19
19
|
) -> None:
|
|
20
|
+
"""
|
|
21
|
+
Create an Options object that hold the credentials and configs options.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
queue_name: name of queue that will be used for subscriptions
|
|
25
|
+
rpc_queue_name: name of queue that will be used for provide resources
|
|
26
|
+
rpc_exchange_name: name of exchange that will be used for provide resources
|
|
27
|
+
uri: uri for connection
|
|
28
|
+
login: username
|
|
29
|
+
passwd: password
|
|
30
|
+
domain: domain
|
|
31
|
+
port: port information
|
|
32
|
+
vhost: vhost information
|
|
33
|
+
heartbeat: interval between heartbeat
|
|
34
|
+
publisher_confirms: wait for publisher confirmations
|
|
35
|
+
**kwargs: pika options
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
>>> Options("example", "example.rpc", "example.rpc", "amqp://admin:admin@localhost:5672/")
|
|
43
|
+
|
|
44
|
+
>>> Options("example", "example.rpc", "example.rpc", "amqps://admin:admin@localhost:5671/")
|
|
45
|
+
|
|
46
|
+
>>> Options("example", "example.rpc", "example.rpc", login="admin", passwd="admin",
|
|
47
|
+
domain="localhost", port=5672)
|
|
48
|
+
|
|
49
|
+
>>> Options("example", "example.rpc", "example.rpc", login="admin", passwd="admin",
|
|
50
|
+
domain="localhost", port=5671)
|
|
51
|
+
"""
|
|
20
52
|
self.queue_name = queue_name
|
|
21
53
|
self.rpc_queue_name = rpc_queue_name
|
|
22
54
|
self.rpc_exchange_name = rpc_exchange_name
|
|
@@ -2,6 +2,22 @@ class SSLOptions:
|
|
|
2
2
|
def __init__(
|
|
3
3
|
self, certfile_path: str, keyfile_path: str, ca_certs_path: str
|
|
4
4
|
) -> None:
|
|
5
|
+
"""
|
|
6
|
+
Create an SslOptions object that hold the certs paths.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
certfile_path: cert file path string
|
|
10
|
+
keyfile_path: private key file path string
|
|
11
|
+
ca_certs_path: ca file path string
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
Um dicionário com as notas da escala e os graus.
|
|
15
|
+
|
|
16
|
+
Raises:
|
|
17
|
+
|
|
18
|
+
Examples:
|
|
19
|
+
>>> SSLOptions("./.certs/cert.pem", "./.certs/privkey.pem", "./.certs/ca.pem")
|
|
20
|
+
"""
|
|
5
21
|
self.certfile_path = certfile_path
|
|
6
22
|
self.keyfile_path = keyfile_path
|
|
7
23
|
self.ca_certs_path = ca_certs_path
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
from .integration_event import IntegrationEvent
|
|
2
2
|
from .integration_event_handler import IntegrationEventHandler
|
|
3
|
+
from .async_provider_handler import AsyncProviderHandler
|
|
4
|
+
from .async_subscriber_handler import AsyncSubscriberHandler
|
|
5
|
+
from .provider_handler import ProviderHandler
|
|
6
|
+
from .subscriber_handler import SubscriberHandler
|
|
@@ -2,8 +2,8 @@ from .eventbus_exception import EventBusException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class AutoReconnectException(EventBusException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
8
|
def __init__(self, message, description="") -> None:
|
|
9
9
|
self.message = message
|
|
@@ -2,9 +2,9 @@ from .eventbus_exception import EventBusException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class BlockingException(EventBusException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
|
-
def __init__(self, message, description="") -> None:
|
|
8
|
+
def __init__(self, message: str, description="") -> None:
|
|
9
9
|
self.message = message
|
|
10
10
|
self.description = description
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class EventBusException(Exception):
|
|
2
|
-
message: str =
|
|
3
|
-
description: str =
|
|
2
|
+
message: str = ""
|
|
3
|
+
description: str = ""
|
|
4
4
|
|
|
5
|
-
def __init__(self, message, description="") -> None:
|
|
5
|
+
def __init__(self, message: str, description="") -> None:
|
|
6
6
|
self.message = message
|
|
7
7
|
self.description = description
|
|
@@ -2,8 +2,8 @@ from .eventbus_exception import EventBusException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class NackException(EventBusException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
8
|
def __init__(self, message, description="") -> None:
|
|
9
9
|
self.message = message
|
|
@@ -2,8 +2,8 @@ from .timeout_exception import TimeoutException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class PublishTimeoutException(TimeoutException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
8
|
def __init__(self, message, description="") -> None:
|
|
9
9
|
self.message = message
|
|
@@ -2,8 +2,8 @@ from .timeout_exception import TimeoutException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class ResponseTimeoutException(TimeoutException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
8
|
def __init__(self, message, description="") -> None:
|
|
9
9
|
self.message = message
|
|
@@ -2,9 +2,9 @@ from .eventbus_exception import EventBusException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class RpcProviderException(EventBusException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
|
-
def __init__(self, message, description="") -> None:
|
|
8
|
+
def __init__(self, message: str, description="") -> None:
|
|
9
9
|
self.message = message
|
|
10
10
|
self.description = description
|
|
@@ -2,9 +2,9 @@ from .eventbus_exception import EventBusException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class ThreadUnsafeException(EventBusException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
|
-
def __init__(self, message, description="") -> None:
|
|
8
|
+
def __init__(self, message: str, description="") -> None:
|
|
9
9
|
self.message = message
|
|
10
10
|
self.description = description
|
|
@@ -2,8 +2,8 @@ from .eventbus_exception import EventBusException
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class TimeoutException(EventBusException):
|
|
5
|
-
message: str =
|
|
6
|
-
description: str =
|
|
5
|
+
message: str = ""
|
|
6
|
+
description: str = ""
|
|
7
7
|
|
|
8
8
|
def __init__(self, message, description="") -> None:
|
|
9
9
|
self.message = message
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from .async_eventbus_rabbitmq import AsyncEventbusRabbitMQ
|
|
2
2
|
from .async_connection_factory import AsyncConnectionFactoryRabbitMQ
|
|
3
|
-
from .async_connection import AsyncConnection
|
|
3
|
+
from .async_connection import AsyncConnection, ConnectionType
|
|
4
4
|
from .async_channel_factory import AsyncChannelFactoryRabbitMQ
|
|
5
5
|
from .async_channel import AsyncChannel
|
|
6
6
|
from .eventbus_rabbitmq import EventbusRabbitMQ
|