amqp-client-python 0.1.14__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.
Files changed (33) hide show
  1. amqp_client_python/domain/models/config.py +32 -2
  2. amqp_client_python/domain/models/options.py +35 -3
  3. amqp_client_python/domain/models/ssl_options.py +16 -0
  4. amqp_client_python/domain/utils/__init__.py +1 -0
  5. amqp_client_python/domain/utils/types.py +7 -0
  6. amqp_client_python/exceptions/auto_reconnect_exception.py +2 -2
  7. amqp_client_python/exceptions/blocking_exception.py +3 -3
  8. amqp_client_python/exceptions/eventbus_exception.py +3 -3
  9. amqp_client_python/exceptions/nack_exception.py +2 -2
  10. amqp_client_python/exceptions/publish_timeout_exception.py +2 -2
  11. amqp_client_python/exceptions/response_timeout_exception.py +2 -2
  12. amqp_client_python/exceptions/rpc_provider_exception.py +3 -3
  13. amqp_client_python/exceptions/thread_unsafe_exception.py +3 -3
  14. amqp_client_python/exceptions/timeout_exception.py +2 -2
  15. amqp_client_python/py.typed +0 -0
  16. amqp_client_python/rabbitmq/async_channel.py +136 -103
  17. amqp_client_python/rabbitmq/async_channel_factory.py +6 -1
  18. amqp_client_python/rabbitmq/async_connection.py +38 -49
  19. amqp_client_python/rabbitmq/async_connection_factory.py +4 -3
  20. amqp_client_python/rabbitmq/async_eventbus_rabbitmq.py +193 -46
  21. amqp_client_python/rabbitmq/channel_factory_rabbitmq.py +3 -1
  22. amqp_client_python/rabbitmq/channel_rabbitmq.py +28 -25
  23. amqp_client_python/rabbitmq/connection_factory_rabbitmq.py +4 -3
  24. amqp_client_python/rabbitmq/connection_rabbitmq.py +12 -10
  25. amqp_client_python/rabbitmq/eventbus_rabbitmq.py +22 -8
  26. amqp_client_python/rabbitmq/eventbus_wrapper_rabbitmq.py +42 -27
  27. amqp_client_python/rabbitmq/ioloop_factory.py +3 -2
  28. amqp_client_python/signals.py +9 -8
  29. {amqp_client_python-0.1.14.dist-info → amqp_client_python-0.2.0.dist-info}/METADATA +64 -54
  30. amqp_client_python-0.2.0.dist-info/RECORD +45 -0
  31. {amqp_client_python-0.1.14.dist-info → amqp_client_python-0.2.0.dist-info}/WHEEL +1 -1
  32. amqp_client_python-0.1.14.dist-info/RECORD +0 -43
  33. {amqp_client_python-0.1.14.dist-info → amqp_client_python-0.2.0.dist-info}/LICENSE +0 -0
@@ -9,16 +9,46 @@ 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 bool(self.ssl_options):
51
+ if self.ssl_options is not None:
22
52
  protocol = "amqps"
23
53
  if self.options.port is None:
24
54
  self.options.port = 5671
@@ -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 = None,
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 +1,2 @@
1
1
  from .connection_type import ConnectionType
2
+ from .types import HandlerType
@@ -0,0 +1,7 @@
1
+ from typing import TypedDict, Optional, Callable
2
+
3
+
4
+ class HandlerType(TypedDict):
5
+ response_timeout: Optional[int]
6
+ handle: Callable
7
+ content_type: str
@@ -2,8 +2,8 @@ from .eventbus_exception import EventBusException
2
2
 
3
3
 
4
4
  class AutoReconnectException(EventBusException):
5
- message: str = None
6
- description: str = None
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 = None
6
- description: str = None
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 = None
3
- description: str = None
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 = None
6
- description: str = None
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 = None
6
- description: str = None
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 = None
6
- description: str = None
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 = None
6
- description: str = None
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 = None
6
- description: str = None
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 = None
6
- description: str = None
5
+ message: str = ""
6
+ description: str = ""
7
7
 
8
8
  def __init__(self, message, description="") -> None:
9
9
  self.message = message
File without changes