Skip to content

Commit da85fac

Browse files
committed
feat: Call into handlers to handle DIDCommV2 messages
Signed-off-by: Colton Wolkins (Laptop) <[email protected]>
1 parent c25ce9a commit da85fac

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

acapy_agent/core/dispatcher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ async def handle_v2_message(
159159
# send a DCV2 Problem Report here for testing, and to punt procotol handling down
160160
# the road a bit
161161
context = RequestContext(profile)
162+
context.message = message
162163
context.message_receipt = inbound_message.receipt
163164
responder = DispatcherResponder(
164165
context,
@@ -208,11 +209,10 @@ async def handle_v2_message(
208209
elif context.message:
209210
context.injector.bind_instance(BaseResponder, responder)
210211

211-
handler_cls = context.message.Handler
212-
handler = handler_cls().handle
212+
handler = context.message
213213
if self.collector:
214214
handler = self.collector.wrap_coro(handler, [handler.__qualname__])
215-
await handler(context, responder)
215+
await handler(context, responder, payload=inbound_message.payload)
216216

217217
async def make_v2_message(self, profile: Profile, parsed_msg: dict) -> BaseMessage:
218218
"""Deserialize a message dict into the appropriate message instance.

acapy_agent/protocols_v2/trustping/v1_0/message_types.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@
1010
# Message types
1111
PING = "trust_ping/1.0/ping"
1212
PING_RESPONSE = "trust_ping/1.0/ping_response"
13+
DEBUG = "https://didcomm.org/basicmessage/2.0/message"
1314

1415
PROTOCOL_PACKAGE = "acapy_agent.protocols.trustping.v1_0"
1516

17+
def test_func(context, responder, payload):
18+
message = payload
19+
print(message)
20+
21+
HANDLERS = {
22+
DEBUG: f"{PROTOCOL_PACKAGE}.message_types.test_func",
23+
}
24+
1625
MESSAGE_TYPES = DIDCommPrefix.qualify_all(
1726
{
1827
PING: f"{PROTOCOL_PACKAGE}.messages.ping.Ping",

0 commit comments

Comments
 (0)