Results 1 to 9 of 9

Thread: How to manually bind to HostPort's or Server Configuration

  1. #1
    Join Date
    Jan 2011
    Posts
    19

    Default How to manually bind to HostPort's or Server Configuration

    Hello,

    I'm writing an application on the Wowza server and would like to be able to be able to create/start VHosts/Applications dynamically. Basically I want the VHosts.xml to contain nothing and have the server launch them. The main reason is I don't want the server to launch them on start, but I also want the app to be completely dynamic.

    I've built the system however I notice that the configured HostPorts do not bind when the VHost instance is created. There's a lot of undocumented API calls and I figure this might be one of them.

    The only work around I've found is to load a different VHosts.xml file after the server has started which will load the vhosts into the system but not start them.

    VHostListUtils.loadConfigFile(Server.getInstance().getVHostList(), System.getProperty("com.wowza.wms.ConfigHome") + "/conf/VHosts2.xml");


    However I'd like to be able to do this without having to load in a file rather I'd like to manually set the configuration such as:

    vhost = VHostSingleton.getInstance("pong", true);
    VHostSingleton.init(vhost.getName(), System.getProperty("com.wowza.wms.ConfigHome") + "/vhosts/pong");

    This starts the VHost ok but the HostPorts don't bind.


    Any advice?


    Also which is the best way to get server properties? System.getProperty("com.wowza.wms.ConfigHome") or Bootstrap.getServerHome(Bootstrap.CONFIGHOME)

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    I'm pretty sure ports defined in each VHost.xml /HostPort /Port binds when the server starts.

    Richard

  3. #3
    Join Date
    Jan 2011
    Posts
    19

    Default

    Right but I'm not starting any VHosts when the server starts. I'm loading them via JMX api / admin server. However the only way I've been able to do that is to set a VHosts.xml config file to be empty then load a dynamic one manually.

    VHostListUtils.loadConfigFile(Server.getInstance() .getVHostList(), System.getProperty("com.wowza.wms.ConfigHome") + "/conf/VHosts2.xml");

    Then I can start and stop the VHosts as a I see fit.


    What I'd like to do however is be able to manually launch VHosts using this command or similar without having a VHosts.xml file:

    vhost = VHostSingleton.getInstance("pong", true);
    VHostSingleton.init(vhost.getName(), System.getProperty("com.wowza.wms.ConfigHome") + "/vhosts/pong");

    However when I do that the VHost starts but none of the ports bind. Also I know that doing it manually like that creates a disconnect between the Server VHostList and the VHostSingleton because the server list just contains a collection of configurations where as the singleton contains a list of active VHost's. So when you launch VHosts programmatically they never get entered into the Server VHostList so you can't start new instances by server.startVHost("name");

    I have come up with a solution to my problem but it entails creating a collection of VHostItem's via my interface then generating a dynamic VHosts.xml file, then having the server reload that configuration. To me it's seems backwards to do it that way but I can make it work via my interface if needs be.


    In the end the best thing would be to know if i can manually set the server's VHostList configuration list so I can make the API programmatically create the VHost configurations. If I'm missing a step please let me know but VHostList seems to be read only. VHostListUtils was my savor that allowed me to complete everything but that isn't in the official API docs so I'm assuming there's might be another helper class out there that starts threads for every HostPort listed in a VHost.xml file. Or if you can tell me how to manually start a HostPort thread that'd be great too so I can start and stop those.



    Pete Couture
    Last edited by PCouture; 07-08-2012 at 09:50 PM.

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Pete,

    What is the reason for doing all that? I don't think it is possible; I will check further, but I think each VHost has to start when Wowza starts.

    Richard

  5. #5
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    I don't think it can work with empty VHosts.xml file. Each VHost has to be defined there. If you want to do it programatically you will have to write to that file. Then you can do this:

    Server.reloadVHostConfig()
    Richard

  6. #6
    Join Date
    Jan 2011
    Posts
    19

    Default

    Hey Richard.

    I'm doing something very similar only using:

    VHostListUtils.loadConfigFile(Server.getInstance().getVHostList(), System.getProperty("com.wowza.wms.ConfigHome") + "/conf/VHostsPong.xml");


    Which allows me to manually set the file name so I can save and load different Vhost profiles.


    What I'd love to know is if there's a way to manually set the Server VHostConfigList without having to load a file. It would help me to cut out the bloat I have to go through via loading XML files.


    - or -

    What would really be awesome is if you have documentation on manually binding VHostPorts without having to restart the VHost. There's API calls for unbinding a HostPort but not turning it back on.


    Cheers,
    Pete

  7. #7
    Join Date
    Jan 2011
    Posts
    19

    Default

    I have a feeling my second option relates to one of these function call but I'm not sure:


    HostPort com.wowza.wms.util.VHostUtils.loadHostPort(Element arg0, IVHost arg1, String arg2)

    void com.wowza.wms.util.VHostUtils.loadHostPortConfig(Element arg0, IVHost arg1, HostPortConfig arg2)


    There's no documentation on the properties.

  8. #8
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    It's not going to work without editing /conf/VHosts.xml.

    What is driving this effort? Do you have many servers? If so, there is a central config utility that might be useful instead. Write to sales@wowza.com to request that. Include a link to this post for reference.

    Richard

  9. #9
    Join Date
    Jan 2011
    Posts
    19

    Default

    I'm using Wowza to do something other than stream video. It requires a great amount of run time control. A central config utility would not work in this case.

Similar Threads

  1. Manually start/stop transcoder
    By kaktus in forum AddOn: Transcoder
    Replies: 1
    Last Post: 07-29-2013, 08:55 AM
  2. WARN vhost comment _defaultVHost_ Bind failed, try again ([any]:80): java.net .Bind
    By kmax1940 in forum Server Administration Discussion
    Replies: 5
    Last Post: 07-22-2013, 06:37 PM

Posting Permissions

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