I want to implement two edge agents using the hyperledger aries dotnet framework. Both agents should use a mediator agent, i.e. calls from one edge agent should be passed to the mediator agent of the second edge agent and then forwarded to the second edge agent.
I set up two mediator agents using the code inside the routing sample: https://github.com/hyperledger/aries-framework-dotnet/tree/master/samples/routing.
My two edge agents are based on the aspnetcore sample: https://github.com/hyperledger/aries-framework-dotnet/tree/master/samples/aspnetcore. I only replaced RegisterAgent
by RegisterEdgeAgent
in Startup.cs
and set the endpointUri
to the one of the corresponding mediator.
When starting the edge agents with the mediator agents running the edge agents connect to their mediator as expected.
But when I try to connect both edge agents (i.e. create an inviation with agent 1 and accept it with agent 2) the connection state remains in 'negotiating'.
It seems that someone has to take care of the InboxItemEvent but I can't figure out how this should be achieved.
Any ideas are very welcome! Thanks!
The default implementation you linked above doesn't automatically check for new messages in their mediator agent. One way to get around this during development is to setup a timer on both edge agents that would check for new messages in their corresponding mediator agent. You would essentially call
IEdgeClient.FetchInboxAsync
every 5 or so seconds. This will process and move your connections fromNegotiating
toConnected
state.The field
InboxItemEvent
is used by mediator agents to notify of new messages, so they can let the edge clients know about new inbox messages. One way they could do this is using Push Notifications. Since you're probably working with console apps, you don't have this option, so setting up a timer and doing manual pull of messages is your best bet.This is exactly what https://github.com/hyperledger/aries-mobileagent-xamarin is doing - a 10sec timer checking for new messages.