edges try to reconnect to a non-existing stream on Origin and never end
I start origin-edge servers and customize my own resolveStreamAlias() @ edge to convert stream url on Origin. I found if what the player subscribes is a non-existing stream on Origin then the Edge server would retry to connect again and again, it never stops even the player disconnects from edge.
If the application stream type is liverepeater-edge then the player connections should control the starting and stopping of the mediaCasters. If there is a player trying to start the stream then the mediaCaster will continue to try to connect. You should disconnect all of the players to let the mediaCaster shut down on it's own.
If you are starting the mediaCaster manually using the api methods or stream manager etc then you can use the IMediaCasterNotify2 interface. Each time a mediaCaster tries to connect or reconnect, it will call onConnectStart. When it has a successful connection, it will call onConnectSuccess and will call onStreamStart when the stream starts. If the connection failed to connect to the remote server then it will call onConnectFailure
When it resets, it will call onStreamStop if the stream actually started and then onConnectStart again. If the stream never started then it will just call onConnectStart.
You should always return a valid url from resolveStreamAlias. By the time this is called, the mediaCaster is already created and is looking for the url to connect to.
You can return null from resolvePlayAlias to prevent the player from playing back a stream and from starting the mediaCaster. You could validate the player request here and only return the stream name if the request is for a valid stream.