From 3e108309d80f7744104be230ed9a234ff90880a2 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Wed, 5 Jul 2023 16:25:05 +0000 Subject: [PATCH 1/3] feat: outbound message in handle message This updates to align with changes made upstream in: https://github.com/hyperledger/aries-cloudagent-python/pull/2170 Signed-off-by: Daniel Bluhm --- redis_queue/v1_0/outbound.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/redis_queue/v1_0/outbound.py b/redis_queue/v1_0/outbound.py index 14a8965..b4a8484 100644 --- a/redis_queue/v1_0/outbound.py +++ b/redis_queue/v1_0/outbound.py @@ -3,12 +3,13 @@ import json import logging -from typing import List, Optional, Union +from typing import Union from aries_cloudagent.core.profile import Profile from aries_cloudagent.transport.outbound.base import ( BaseOutboundTransport, OutboundTransportError, + QueuedOutboundMessage, ) from aries_cloudagent.transport.wire_format import ( DIDCOMM_V0_MIME_TYPE, @@ -41,7 +42,8 @@ def __init__(self, root_profile: Profile): or OutboundConfig.default() ) LOGGER.info( - f"Setting up redis outbound queue with configuration: {self.outbound_config}" + "Setting up redis outbound queue with configuration: %s", + self.outbound_config, ) self.redis = root_profile.inject_or(RedisCluster) self.is_mediator = self.outbound_config.mediator_mode @@ -63,12 +65,13 @@ async def stop(self): async def handle_message( self, profile: Profile, - payload: Union[str, bytes], + outbound_message: QueuedOutboundMessage, endpoint: str, metadata: dict = None, api_key: str = None, ): """Prepare and send message to external queue.""" + payload = outbound_message.payload if not endpoint: raise OutboundTransportError("No endpoint provided") headers = metadata or {} @@ -105,4 +108,4 @@ async def handle_message( message, ) except (RedisError, RedisClusterException) as err: - LOGGER.exception(f"Error while pushing to Redis: {err}") + LOGGER.exception("Error while pushing to Redis: %s", err) From 90bba5ba0361aa3f32e55eeb4953fec5e9345764 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Wed, 5 Jul 2023 17:32:30 +0000 Subject: [PATCH 2/3] fix: update init for redis outbound queue And remove unused imports Signed-off-by: Daniel Bluhm --- redis_queue/v1_0/outbound.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/redis_queue/v1_0/outbound.py b/redis_queue/v1_0/outbound.py index b4a8484..225f627 100644 --- a/redis_queue/v1_0/outbound.py +++ b/redis_queue/v1_0/outbound.py @@ -3,8 +3,8 @@ import json import logging -from typing import Union +from aries_cloudagent.transport.wire_format import BaseWireFormat from aries_cloudagent.core.profile import Profile from aries_cloudagent.transport.outbound.base import ( BaseOutboundTransport, @@ -34,9 +34,13 @@ class RedisOutboundQueue(BaseOutboundTransport): schemes = ("redis",) is_external = True - def __init__(self, root_profile: Profile): + def __init__( + self, + wire_format: BaseWireFormat, + root_profile: Profile, + ): """Initialize base queue type.""" - super().__init__(root_profile) + super().__init__(wire_format, root_profile) self.outbound_config = ( get_config(root_profile.context.settings).outbound or OutboundConfig.default() From 7f9cd7ae248f57c3feca946bc3678b3f5c2740ae Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Wed, 5 Jul 2023 17:47:17 +0000 Subject: [PATCH 3/3] docs: add note to readme about acapy versions Signed-off-by: Daniel Bluhm --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 64586c7..93a4910 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ Covered in ./docker/README.md First, install this plugin into your environment: +> **Note** Deployments of the main branch of this repository must be used with ACA-Py artifacts created **after** [ACA-Py PR #2170](https://github.com/hyperledger/aries-cloudagent-python/pull/2170)). If you are using an earlier ACA-Py release (e.g., version 0.8.2 and earlier), you **MUST** use the v0.0.1 tag of this repository. + ```sh $ pip install git+https://github.com/bcgov/aries-acapy-plugin-redis-events.git ```