Skip to content

Commit

Permalink
Merge pull request #73 from epam/develop
Browse files Browse the repository at this point in the history
5.1.7
  • Loading branch information
oleksandr-onsha authored Aug 21, 2024
2 parents c28a68b + 60711b3 commit 1df253f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.1.7] - 2024-08-20
- added more logs for RabbitMQ connection
- rollback `pika` to fix breaking changes

## [5.1.6] - 2024-08-19
- remove usage of `accN` index for Tenants model. Proxy old methods and attributes to `acc` index

Expand Down
26 changes: 17 additions & 9 deletions modular_sdk/connections/rabbit_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _close(self):

def publish(self, message, routing_key, exchange='', headers=None,
content_type=None):
_LOG.debug(f'Request queue: {routing_key}')
channel = self._open_channel()
channel.confirm_delivery()
response = channel.basic_publish(
Expand All @@ -43,16 +44,19 @@ def publish(self, message, routing_key, exchange='', headers=None,
mandatory=True)
self._close()
if not response:
message = ('Message was returned. Check RabbitMQ '
'configuration: maybe target queue does not exists.')
_LOG.error(message)
raise ModularException(code=504, content=message)
_LOG.error(f'Message was not sent: routing_key={routing_key}, '
f'exchange={exchange}, content_type={content_type}')
raise ModularException(
code=504,
content='Message was not sent. Check RabbitMQ configuration'
)
_LOG.info('Message pushed')

def publish_sync(self, message, routing_key, correlation_id,
callback_queue, exchange='', headers=None,
content_type=None):

_LOG.debug(f'Request queue: {routing_key}; '
f'Response queue: {callback_queue}')
channel = self._open_channel()
channel.confirm_delivery()
response = channel.basic_publish(
Expand All @@ -64,10 +68,14 @@ def publish_sync(self, message, routing_key, correlation_id,
content_type=content_type),
body=message)
if not response:
message = ('Message was returned. Check RabbitMQ '
'configuration: maybe target queue does not exists.')
_LOG.error(message)
raise ModularException(code=504, content=message)
_LOG.error(f'Message was not sent: routing_key={routing_key}, '
f'correlation_id={correlation_id}, '
f'callback_queue={callback_queue}, '
f'exchange={exchange}, content_type={content_type}')
raise ModularException(
code=504,
content='Message was not sent. Check RabbitMQ configuration'
)
_LOG.info('Message pushed')

def consume_sync(self, queue, correlation_id):
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "modular_sdk"
version = "5.1.6"
version = "5.1.7"
authors = [
{name = "EPAM Systems", email = "support@syndicate.team"}
]
Expand All @@ -19,7 +19,7 @@ classifiers = [
"Operating System :: OS Independent"
]
dependencies = [
"pika>=1.3.2,<2.0",
"pika==1.0.0b1",
"pynamodb>=5.5.1,<6",
"boto3>=1.26.80,<1.35",
"botocore>=1.29.80,<1.35",
Expand Down
23 changes: 9 additions & 14 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
pika==1.0.0b1
pynamodb==5.3.2
boto3==1.26.80
botocore==1.29.80
dynamodb-json==1.3
pymongo==4.5.0
python-dateutil==2.8.2
simplejson==3.19.1
six==1.16.0
urllib3==1.26.16
aws-xray-sdk==2.12.0
pycparser==2.21
cffi==1.15.1
cryptography==41.0.3
cachetools==5.3.1
pynamodb>=5.5.1,<6
boto3>=1.26.80,<1.35
botocore>=1.29.80,<1.35
pymongo~=4.5.0
python-dateutil>=2.8.2,<3.0
cachetools~=5.4.0
dynamodb-json~=1.4.2
aws-xray-sdk~=2.14.0
cryptography~=41.0.7

0 comments on commit 1df253f

Please sign in to comment.