Restart Application from API

I am having trouble getting a successful restart done using either the API in a Http Provider or using the jmx api with this example Sample Java class for creating a command line interface to control Wowza Media Server. I am using an rtp stream with a .stream file in the content directory and in startupstreams.xml.

My understanding is that there is no need to explicitly call a method on appInstance to actually start the app (there is a shutdown but not a start method in the API) and that it will restart when a client attempts to connect. However I am getting a stream not found when attempting to connect after a shutdown. I then have to ssh into the instance and call restart on the Wowza process to get the stream working again.

Am I missing a restart equivalent in the API, or is there something else I’m missing? Here is what I’m doing to shutdown:

IServer server = Server.getInstance();	
	IApplication app1 = vhost.getApplication(server.getProperties()
		.getPropertyStr("PublishToApplication", "live"));
	IApplicationInstance instance = app1.getAppInstance("_definst_");
	instance.shutdown(false, false);

Thanks,

Grant

Are you using StreamType “live” and starting the stream in StartUpStreams.xml? If so, you have to restart the stream after stopping the application. You can use the MediaCaster API

https://www.wowza.com/docs/how-to-use-the-wowza-streaming-engine-java-api-to-start-and-stop-mediacaster-streams

Richard

You’re welcome, glad I could help.

Richard

Yes, I am using StartupStreams.xml. I wondered what the MediaCaster API was.

Thanks again.