I have an umbrella project that contains three applications:
-
my_app
(logic and database layer) -
my_app_web
(Phoenix application, depends onmy_app
) -
my_app_grpc
(gRPC endpoints, depends onmy_app
)
my_app_grpc
sends messages to a GenServer that is inside my_app
, which is fine. The problem is that this GenServer has to send callbacks to a gRPC stream. The solution I found without needing to add my_app_grpc
as a dependency was to create a process inside my_app_grpc
and just send a message to it through my_app
, so all gRPC related work would be still inside its own application.
It works but I can’t test this message is being sent inside my_app
tests, as the other applications are not running.
grpc_pid = Process.whereis(MyAppGrpc.Foo)
:erlang.trace(grpc_pid, true, [:receive])
assert_receive {:trace, ^grpc_pid, :receive, :my_message}
I just wanted to guarantee this message is being sent, as it’s a critical part of my system.