# Do basic server-side publishing with the Stream class and Wowza Streaming Engine Java API

Updated on 07/16/2026 8:30 am PDT

Use the **Stream** class to publish live streams using static content. You can also publish on a schedule, like a television station.

This example illustrates basic use of the **Stream** class:

Copy

```
package com.wowza.wms.example.serverlistener;

import com.wowza.wms.logging.WMSLoggerFactory;
import com.wowza.wms.server.*;
import com.wowza.wms.vhost.*;
import com.wowza.wms.stream.publish.*;
import com.wowza.wms.application.*;

public class StreamPublisherDemo implements IServerNotify2 {

public void onServerConfigLoaded(IServer server)
	{
	}

public void onServerCreate(IServer server)
	{
	}

public void onServerInit(IServer server)
	{
		IVHost vhost = VHostSingleton.getInstance(VHost.VHOST_DEFAULT);
		IApplication app = vhost.getApplication("live");
		IApplicationInstance appInstance = app.getAppInstance("_definst_");

Stream stream1 = Stream.createInstance(vhost, "live", "Stream1");

stream1.play("mp4:sample.mp4", 5, 5, true);
		stream1.play("mp4:sample.mp4", 50, 5, false);
		stream1.play("mp4:sample.mp4", 150, 5, false);
		stream1.addListener(new StreamListener(appInstance));

Stream stream2 = Stream.createInstance(vhost, "live", "Stream2");

stream2.play("mp4:sample.mp4", 0, -1, true);
		stream2.addListener(new StreamListener(appInstance));

}

public void onServerShutdownStart(IServer server)
	{
	}

public void onServerShutdownComplete(IServer server)
	{
	}

class StreamListener implements IStreamActionNotify
	{
		StreamListener(IApplicationInstance appInstance)
		{
		}
		public void onPlaylistItemStop(Stream stream, PlaylistItem item)
		{
			WMSLoggerFactory.getLogger(null).info("Item Stopped: " + item.getName() + "on Stream: " + stream.getName());
		}
		public void onPlaylistItemStart(Stream stream, PlaylistItem item)
		{
			WMSLoggerFactory.getLogger(null).info("Item Started: " + item.getName() + "on Stream: " + stream.getName());
		}
	}
}
```

Add the server listener to /conf/Server.xml /ServerListeners:

Copy

```
	<ServerListener>
		<BaseClass>com.wowza.wms.example.serverlistener.StreamPublisherDemo</BaseClass>
	</ServerListener>
```

Create a live application named **live** (with the **StreamType** property in the **<Streams>** container element in **\[ _install-dir_\]/live/Application.xml** set to **live**) if one does not already exist.

Was this article helpful?

[Helpful](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams# "Helpful"/index.html)

Thank you for your feedback!

300 characters remaining

Name

Email

reCAPTCHA

Recaptcha requires verification.

I'm not a robot

reCAPTCHA

[Submit](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams# "Submit comment"/index.html)

Thank you for providing feedback to help us improve our documentation!

##### Popular Video Topics [Copy to clipboard](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams\#popular-video-topics "Copy to clipboard"/index.html)

- [The Future of Video Tech](/content/blog/future-of-video-technology/index.html)
- [Streaming Starter Guide](/content/blog/complete-guide-to-live-streaming/index.html)
- [Live Event Streaming Guide](/content/blog/live-event-streaming-guide/index.html)
- [Interactive Streaming Guide](/content/blog/low-latency-streaming-technologies-the-key-to-interactive-video/index.html)
- [Streaming Protocols](/content/blog/streaming-protocols/index.html)
- [Transcoding](/content/blog/what-is-transcoding-and-why-its-critical-for-streaming/index.html)
- [Low Latency](/content/blog/what-is-low-latency/index.html)
- [Security](/content/blog/secure-video-streaming/index.html)

##### Video Resources [Copy to clipboard](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams\#video-resources "Copy to clipboard"/index.html)

- [APIs & SDKs](/content/docs/wowza-developer-apis-and-sdks/index.html)
- [Developer IDE](/content/docs/how-to-extend-wowza-streaming-engine-using-the-wowza-ide/index.html)
- [Test Players](/content/testplayers/index.html)
- [Wowza System Status](https://status.wowza.com/)

##### Partners [Copy to clipboard](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams\#partners "Copy to clipboard"/index.html)

- [Partners Overview](/content/partners/index.html)
- [Find a Partner](/content/partners/preferred-international-resellers/index.html)
- [Channel Program](/content/partners/channel-partner-program/index.html)
- [OEM Program](/content/partners/oem/index.html)
- [Partner Portal](/content/partners/resources/index.html)

##### Company [Copy to clipboard](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams\#company "Copy to clipboard"/index.html)

- [About Us](/content/company/index.html)
- [Blog](/content/blog/category/blog/index.html)
- [News](/content/news/index.html)
- [Events & Webinars](/content/company/events/index.html)
- [Careers](/content/careers/index.html)
- [Customers](/content/customers/index.html)
- [Contact Us](/content/contact/index.html)

##### Stay Connected [Copy to clipboard](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams\#stay-connected "Copy to clipboard"/index.html)

##### Stay Up to Date with the Blog [Copy to clipboard](/content/docs/how-to-do-basic-server-side-publishing-with-stream-class-streams\#stay-up-to-date-with-the-blog "Copy to clipboard"/index.html)

Email

X - Form Filled Type

© 2007–2025 Wowza Media Systems™, LLC. All rights reserved.   [Security & Privacy Policy](/content/legal/privacy/index.html) \| [Legal](/content/legal/index.html) \| [System Status](https://status.wowza.com/)

reCAPTCHA
