Skip to content

Commit

Permalink
fix: Changes to ensure connection to Azure Service Bus.
Browse files Browse the repository at this point in the history
  • Loading branch information
dallinb authored Dec 30, 2024
1 parent 0df2cc6 commit eb954e9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions router.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
import itertools
import json
import logging
import os
Expand Down Expand Up @@ -311,6 +312,9 @@ def decode_message(self, message: bytes) -> str:
"""
if isinstance(message, str):
return message
elif isinstance(message, memoryview):
message = message.tobytes()

return message.decode('utf-8')

def get_data(self, message: object) -> list:
Expand Down Expand Up @@ -344,7 +348,7 @@ def get_data(self, message: object) -> list:
result = jmespath.search(self.jmespath, message)

if isinstance(result, list):
return result
return list(itertools.chain.from_iterable(result))
elif result is None:
return []

Expand Down Expand Up @@ -740,7 +744,7 @@ def on_start(self, event):
for url in self.connections.keys():
hostname = urlparse(url).hostname
logger.debug(f'Creating a connection for {hostname}...')
connection = event.container.connect(url)
connection = event.container.connect(url, allowed_mechs='PLAIN')
self.connections[url] = connection
logger.info(f'Successfully created a connection for {hostname}.')

Expand Down

0 comments on commit eb954e9

Please sign in to comment.