aries-cloudagent-python icon indicating copy to clipboard operation
aries-cloudagent-python copied to clipboard

:art: Enable emit event for `wallet_record`

Open ff137 opened this issue 7 months ago • 2 comments

With logging changes we can now see when emit_event is called for a record that does not have a topic defined: e.g.

WARNING Emit event called but RECORD_TOPIC is not set for wallet_record
...
WARNING Emit event called but RECORD_TOPIC is not set for forward_route

These appear to be the only unimplemented webhook topics.

I'm not so sure about the forward_route one - presumably the warning log can just be silenced for that one? Seems to occur when OOB invites are created or received.

But for wallet_record, it may be pretty useful if an admin could subscribe on a topic to record tenants that are created, updated or deleted.

Thoughts?

ff137 avatar May 20 '25 09:05 ff137

Apologies - I thought the logging changes were already contributed to main, but it was just running in our fork.

It's essentially in acapy_agent.messaging.models.base_record.py::emit_event, we added:

    async def emit_event(self, session: ProfileSession, payload: Optional[Any] = None):
        """Emit an event.

        Args:
            session: The profile session to use
            payload: The event payload
        """

        if not self.RECORD_TOPIC:
            LOGGER.warning(
                "Emit event called but RECORD_TOPIC is not set for %s",
                self.RECORD_TYPE,
            )
            return

This change is in draft here: https://github.com/openwallet-foundation/acapy/pull/3689/files#diff-ab2bb5af01f421fe1a7e39e66a2e9e6fa2edba73d8c2f0b77e88ea064687f051

ff137 avatar Jun 11 '25 11:06 ff137

@swcurran Added more context to the above - I recall it was discussed in one of the meetings.

The forward_route warnings can probably be suppressed - not sure how informative they are - but the events for wallet_records (seems to be for creates, updates, deletes) may be useful for an admin to be able to track

ff137 avatar Jun 11 '25 11:06 ff137