# Overriding publish and releaseStream

**URL:** https://community.wowza.com/t/overriding-publish-and-releasestream/40559
**Category:** Wowza Developer Dojo
**Tags:** wowza-streaming-server-java-api
**Created:** [October 28, 2014, 2:33pm UTC](https://community.wowza.com/t/overriding-publish-and-releasestream/40559 "2014-10-28T14:33:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Alexey\_Tsessarskiy](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@Alexey\_Tsessarskiy](https://community.wowza.com/u/Alexey_Tsessarskiy)
#### Post date: [October 28, 2014, 2:33pm UTC](https://community.wowza.com/t/overriding-publish-and-releasestream/40559/1 "2014-10-28T14:33:38Z")

</div>

Hi!

We need to control publishing using some custom logic, for example

```auto
public void publish(IClient client, RequestFunction function, AMFDataList params)
{
if(this.someCustomLogic())
invokePrevious(client, function, params);
}

```

Seems like there are two methods - ModuleBase:: publish and ModuleBase::releaseStream to control streams publishing. There is no documentation for those methods. Can you please explain what is the purpose/difference between those two, and shell we override both, or one is enough?

Thanks, Alex.

---

<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: [October 31, 2014, 8:19am UTC](https://community.wowza.com/t/overriding-publish-and-releasestream/40559/2 "2014-10-31T08:19:28Z")

</div>

Take a look at our [limit publish by IP example](https://www.wowza.com/docs/how-to-limit-publishing-of-live-streams-by-ip-list) for how to handle this event. releaseStream is called when there is already a stream being published with the same name.

---

<div class="post-metadata">

### Author: ![Alexey\_Tsessarskiy](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@Alexey\_Tsessarskiy](https://community.wowza.com/u/Alexey_Tsessarskiy)
#### Post date: [November 3, 2014, 5:53pm UTC](https://community.wowza.com/t/overriding-publish-and-releasestream/40559/3 "2014-11-03T17:53:00Z")

</div>

Thank you, Matt!

---

<div class="post-metadata">

### Author: ![Alexey\_Tsessarskiy](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@Alexey\_Tsessarskiy](https://community.wowza.com/u/Alexey_Tsessarskiy)
#### Post date: [November 3, 2014, 6:16pm UTC](https://community.wowza.com/t/overriding-publish-and-releasestream/40559/4 "2014-11-03T18:16:06Z")

</div>

There is another question. We see releaseStream being called even for non-existing streams.

We have the following setup to try:

One wowza, two origin applications - live and target.

live application is default Wowza origin application. It pulls some feed from rtmp URL provided in stream file, and started with mediacaster, and push it into target application, using PushPublish module and the following settings in PushPublishMap.txt:

test.stream={profile:“rtmp”, streamName:“test”, host:“127.0.0.1”, application:“target”}

Target application does not have any streams running. When live starts to pull a test.stream and therefore starts to push it into the target application, both releaseStream and publish functions are being called.

Only difference in target application is that it has custom StreamNameAliasProvider.

Such behaviour does not correspond to your reply: “releaseStream is called when there is already a stream being published with the same name.”

Can you please provide bit more details, why releaseStream is called on target application?

Many thanks, Alex

---

<div class="post-metadata">

### Author: ![Alexey\_Tsessarskiy](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@Alexey\_Tsessarskiy](https://community.wowza.com/u/Alexey_Tsessarskiy)
#### Post date: [November 25, 2014, 3:18pm UTC](https://community.wowza.com/t/overriding-publish-and-releasestream/40559/5 "2014-11-25T15:18:16Z")

</div>

up
