# Shutdown idle (re-connecting) MediaCasterStream

**URL:** <https://community.wowza.com/t/shutdown-idle-re-connecting-mediacasterstream/553>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [March 10, 2016, 7:37am UTC](https://community.wowza.com/t/shutdown-idle-re-connecting-mediacasterstream/553 "2016-03-10T07:37:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [March 10, 2016, 7:37am UTC](https://community.wowza.com/t/shutdown-idle-re-connecting-mediacasterstream/553/1 "2016-03-10T07:37:19Z")

</div>

Hi,

I`m struckeling…

Can someone explain what classes and methods are called when I click on “Disconnect Stream” in the EngineManager!

> “For managed streams that this application connects to through the MediaCaster system, click the Disconnect icon to disconnect the application from stream.”

I want to do that in an HTTPProvider or programmatically. (Not using REST Interface)

I tryied several things e.g.

- appInstance.stopMediaCasterStream(streamName) =\> Works only if Stream is not in Status “Waiting for Stream”;

- MediaCasterStreamItem.release();

- MediaCasterStreamItem.shutdown();

It allways keeps existing unter:

Engine Manger \> Incoming Streams \> ActiveStreams

Status: “Waiting for Stream”

=\>Only when using the Enginemanager “Disconnect Stream” Button, the stream disappears and logs show (my Streamfile is called: “invalid-ip.stream”):

```auto
RTPMediaCaster.shutdown[1966205695:switchtest/707001:invalid-ip.stream]: invalid-ip.stream
INFO server comment - RTPMediaCaster.disconnect[1966205695:switchtest/707001:invalid-ip.stream]
INFO server comment - RTPMediaCaster.closeRTPSession[1966205695:switchtest/707001:invalid-ip.stream]
INFO server comment - REST API: REST API: Disconnect Stream: Publish stream successfully stopped [switchtest/707001]: invalid-ip.stream
INFO server comment - REST API: IncomingStreamConfig.disconnectStreamAction: Publish stream successfully stopped [switchtest/707001]: invalid-ip.stream

```

How can I stop a incoming RTSP stream (from \*.stream file) which is not healthy or in status “Waiting for Stream” ?

---

<div class="post-metadata">

**Author:** ![Neutralo\_the\_neutral](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Neutralo\_the\_neutral](https://community.wowza.com/u/Neutralo_the_neutral)\
**Post date:** [March 11, 2016, 4:18am UTC](https://community.wowza.com/t/shutdown-idle-re-connecting-mediacasterstream/553/2 "2016-03-11T04:18:56Z")

</div>

Please describe what Java Classes Objects are called with this HTTP Post:

POST:

/enginemanager/streams/incomingstreams/disconnectStream.htm

vhost:_defaultVHost_

appName:switchtest

appType:live

appSection:incomingstreams

instanceName:MyInstanceName

streamName:switchstream2.stream

returnPage:incomingstreams

parentPage:incomingstreams

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [March 16, 2016, 8:49am UTC](https://community.wowza.com/t/shutdown-idle-re-connecting-mediacasterstream/553/3 "2016-03-16T08:49:38Z")

</div>

Hello

You can leverage the mediacaster http provider by issuing the following request:

Ex:

[stream-file] : teststream.stream

[app-name] : testapp/_definst_

```auto
  
curl –digest -u myuser:mypassword "http://localhost:8086/streammanager/streamAction?action=deleteStream" –data “vhostName=_defaultVHost_&appName=[app-name]&streamName=[stream-file]”

```

From the Java API perspective,

```auto
IApplicationInstance.stopMediaCasterStream(streamName)

```

This works if the stream is started as you’ve seen it will shut it down. If the status is “Waiting for Stream” then there isn’t really anything to shut down.

Thanks,

Matt
