Wowza Community

Life cycle diagram for Application

Hi,

Application life cycle isn’t documented.

For example, when an instance is created, destroyed…

Thanks

An application instance is created when a client connects to it (encoder or playback clients) or when a Wowza process, typically a ServerListener or StartUpStreams, starts a stream on an application/instance. The application instance is unload 60 seconds after the last client disconnect and there is no server-side process keeping it loaded. I’m not sure if/where that is exactly documented.

Richard

Ok.

  1. What will happen to all published stream if application is unloaded?

Do we need to republish all the streams?

(Assume streams are published by API method)

  1. What do you mean by server process?

Assume there are no clients’ connections.

This example will keep it loaded?

Or an application will be unloaded after 60 seconds.

An example from your previous answer.

http://www.wowza.com/forums/showthread.php?9523-Having-an-Application-Instance-start-on-server-startup

package com.wowza.wms.example.serverlistener;
import com.wowza.wms.application.IApplication;
import com.wowza.wms.logging.*;
import com.wowza.wms.server.*;
import com.wowza.wms.vhost.IVHost;
import com.wowza.wms.vhost.VHost;
import com.wowza.wms.vhost.VHostSingleton;
public class ServerListenerStartupApp implements IServerNotify2 {
	public void onServerConfigLoaded(IServer server) {
		WMSLoggerFactory.getLogger(null).info("onServerConfigLoaded");
	}
	public void onServerCreate(IServer server) {
		WMSLoggerFactory.getLogger(null).info("onServerCreate");
	}
	public void onServerInit(IServer server) {
		WMSLoggerFactory.getLogger(null).info("onServerInit");
		IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);
		IApplication app = vhost.getApplication("live");
		app.getAppInstance("_definst_");
		
	}
	public void onServerShutdownStart(IServer server) {
		WMSLoggerFactory.getLogger(null).info("onServerShutdownStart");
	}
	public void onServerShutdownComplete(IServer server) {
		WMSLoggerFactory.getLogger(null).info("onServerShutdownComplete");
	}
}

Hi,

In this example, the application instance will load when the server starts and will unload after the last players have disconnected for at least 60 secs and there are no other streams running.

By other streams, I am meaning streams started with the Publishing or Streams apis or remote streams started with the mediaCaster apis or withe the stream manager or Startup Streams.

There is one thing to note and for the application instance to be able to shut down after the timeout, there has to have been at least one client connection (any protocol) to trigger the beginning or the timeout process. Otherwise, you will have to manually shutdown the application instance.

Roger.