Results 1 to 4 of 4

Thread: How to access configuration from server listener (IServerNotify2)?

  1. #1
    Join Date
    Apr 2014
    Posts
    2

    Question How to access configuration from server listener (IServerNotify2)?

    Hello,

    trying to access configuration in server listeners methods:
    onServerConfigLoaded(IServer server) and onServerCreate(IServer server)


    server.getProperties().get('key') gives me null;
    server.getProperties().getAllAsStrings() and iterating over result gives me null pointer exception;
    same with getManagerProperties().

    server.getConfig(path) gives me whole xml as a string (??)


    wowzaStreamingEngine 4.0.1


    How can i access properties from Server.xml config?

    + bonus question: how to access applications configs from this server listener ?

  2. #2
    Join Date
    Apr 2014
    Posts
    2

    Default

    solved by creating app instance on server startup. Will it create some additional problems?
    private WMSProperties getAppConfig(String appName, String vhostName) {
        IVHost vhost = VHostSingleton.getInstance(vhostName, true) ;
        Application app = new Application(appName, vhost);
        IApplicationInstance appi = app.getAppInstance(appName);
        return appi.getProperties();
    }

  3. #3
    Join Date
    Dec 2007
    Posts
    22,013

    Default

    Hi,

    You can get and set properties like this:

    server.getProperties().getPropertyStr("key");
    		
    server.getProperties().setProperty("key", "someKey");
    This does not write to files, it is only in memory. You can do the same with most other objects in Wowza as well.

    Richard

  4. #4

    Default

    Quote Originally Posted by eyveer View Post
    solved by creating app instance on server startup. Will it create some additional problems?
    private WMSProperties getAppConfig(String appName, String vhostName) {
        IVHost vhost = VHostSingleton.getInstance(vhostName, true) ;
        Application app = new Application(appName, vhost);
        IApplicationInstance appi = app.getAppInstance(appName);
        return appi.getProperties();
    }
    Hi,

    This method will work if you are just reading properties that are set in the Application.xml however, you wont be able to modify any ans you application has not been fully started.

    You should use
    IApplication app = vhost.getApplication(appName);
    This will start the application properly.

    Roger.

Similar Threads

  1. CDN Access problem from wowza configuration
    By skakska in forum Wowza Streaming Engine in the Cloud
    Replies: 1
    Last Post: 03-31-2014, 06:54 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
  •