Get HTTP and RTP performance statistics with a Wowza Streaming Engine Java module

The following example module for Wowza Streaming Engine™ gets performance stats for Cupertino, Smooth, SanJose, and RTP sessions:

package com.wowza.wms.example.module;

import com.wowza.util.IOPerformanceCounter;
import com.wowza.wms.httpstreamer.cupertinostreaming.httpstreamer.*;
import com.wowza.wms.httpstreamer.model.*;
import com.wowza.wms.httpstreamer.sanjosestreaming.httpstreamer.HTTPStreamerSessionSanJose;
import com.wowza.wms.httpstreamer.smoothstreaming.httpstreamer.*;
import com.wowza.wms.module.*;
import com.wowza.wms.rtp.model.*;

public class ModuleSessionStats extends ModuleBase {

	//This will work for Cupertino, Smooth and SanJose sessions
	public void onHTTPSessionDestroy(IHTTPStreamerSession httpSession) {
		IOPerformanceCounter perf = httpSession.getIOPerformanceCounter();

		Long outbytes = perf.getMessagesOutBytes();
		getLogger().info("Outbytes: " + outbytes);

		Double outrate = perf.getMessagesOutBytesRate();
		getLogger().info("OutRate: " + outrate);

		Double seconds = outbytes / outrate;
		getLogger().info("Seconds: " + seconds);
	}

	//Cupertino (iOS)
	public void onHTTPCupertinoStreamingSessionDestroy(
			HTTPStreamerSessionCupertino httpSession) {
		IOPerformanceCounter perf = httpSession.getIOPerformanceCounter();
		getLogger().info("HTTPCupertinoStreamingSession OutBytes: " + perf.getMessagesOutBytes());
	}

	//Smooth (Silverlight)
	public void onHTTPSmoothStreamingSessionDestroy(
			HTTPStreamerSessionSmoothStreamer httpSession) {
		IOPerformanceCounter perf = httpSession.getIOPerformanceCounter();
		getLogger().info("HTTPStreamerSessionSmoothStreamer OutBytes: " + perf.getMessagesOutBytes());
	}

	//Sanjose (Flash HTTP))
	public void onSanJoseStreamingSesssionDestroy(HTTPStreamerSessionSanJose httpSession)
	{
		IOPerformanceCounter perf = httpSession.getIOPerformanceCounter();
		getLogger().info("HTTPStreamerSessionSanJose OutBytes: " + perf.getMessagesOutBytes());
	}

	//RTP
	public void onRTPSessionDestroy(RTPSession rtpSession) {
		IOPerformanceCounter perf = rtpSession.getIOPerformanceCounter();
		getLogger().info("RTPSession OutBytes: " + perf.getMessagesOutBytes());
	}
}