Results 1 to 4 of 4

Thread: Shutdown app instance

  1. #1
    Join Date
    Sep 2010
    Posts
    4

    Default Shutdown app instance

    Hi

    I'm building a chat system, each application instance will represent a channel. For instance:

    rtmp://localhost/chat/channelname

    In the on onAppStart handler I need to query a database to see if the channel name (instance name) exists and also get the config for the channel. If the channel doesn't exist in the database, or there was an issue with the query I need to close the application instance.

    I've tried calling appInstance.getApplication().shutdownAppInstance(appInstance.getName()); in the onAppStart handler and clients can still connect to the chat instance.

    I've also tried calling client.rejectConnection(); and appInstance.getApplication().shutdownAppInstance(appInstance.getName()); in the onConnect handler and it seems to work. Is this the best approach? Or is there a better way?

    Thanks

  2. #2
    Join Date
    Sep 2011
    Posts
    1,933

    Default

    Hi,
    When a client connects to Wowza an application instance is created automatically. When you shutdown the application instance it will only be stopped for that moment in time as when another client connects it will be created again, so each time a client connects you would have to do the same check.

    Jason

  3. #3
    Join Date
    Sep 2011
    Posts
    1,933

    Default

    Hi,
    Also, I think the best way would be to handle this using on onConnect, then do client.rejectConnection(), and the app instance will be created but away in 60 seconds with no clients connected.

    Jason

  4. #4
    Join Date
    Sep 2010
    Posts
    4

    Default

    Hi, thanks for the replies.

    I decided to go ahead with calling appInstance.getApplication().shutdownAppInstance(appInstance.getName()) in the onAppStart handler if a channel doesn't exist in the database, or if there's a problem loading the channel settings from the database. I then call client.rejectConnection() in the onConnect handler. So when another client comes along the onAppStart event will be fired and it can check if the channel exists and attempt to load the channel settings again straight away.

Similar Threads

  1. Using FFmpeg with an RTMP Wowza stream on an app instance as the source
    By Benny Veo in forum Live Streaming and Encoder Discussion
    Replies: 2
    Last Post: 08-21-2013, 08:15 AM
  2. app instance hangs on mysql connect error
    By gabole29 in forum General Forum
    Replies: 6
    Last Post: 03-24-2012, 09:34 AM
  3. Can't shut out a client from an app instance....
    By sprocket in forum Server-side Modules and Code Samples Discussion
    Replies: 4
    Last Post: 12-02-2011, 05:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •