GitHub user nickwallen opened a pull request:

    https://github.com/apache/metron/pull/740

    METRON-1167 Define Session Specific Global Configuration Values in the REPL

    Many Stellar functions accept configuration values from the Global 
configuration.  When using the REPL you can load the global configuration 
values by launching the REPL with the -z option, which loads the global 
configuration stored in Zookeeper.
    
    The only way to modify the global configuration within the REPL currently 
is to do the following steps.
    1. Retrieve the global configuration with conf := CONFIG_GET("global")
    2. Alter that global configuration by modifying the JSON contained in the 
`conf` variable.
    3. Push the new global configuration using CONFIG_PUT("global", conf)
    4. Close and then reopen the REPL.  Without restarting the REPL the new 
global configuration is not loaded.
    
    I want a way to do this directly in the REPL, without restarting it, and 
also in a way that does not modify the persisted global configuration in 
Zookeeper.  I may be monkeying with something the REPL, but I don't want to 
break one of my live Metron topologies.
    
    ### Test Drive
    
    1. Check-out this PR and build Metron. 
         ```
         mvn clean install -DskipTests -T1C
         ```
    
    1. Then from the root of the Metron source directory, launch the REPL.
        ```
        $ mvn exec:java \
            
-Dexec.mainClass="org.apache.metron.stellar.common.shell.StellarShell" \
            -pl metron-stellar/stellar-common/
        ```
    
    1. Then ``%define`, `%undefine`, and `%globals` to your heart's content.
        ```
        [Stellar]>>> %globals
        {}
        [Stellar]>>> %define foo = bar
        [Stellar]>>> %globals
        {foo=bar}
        [Stellar]>>> %define baz=bash
        [Stellar]>>> %globals
        {foo=bar, baz=bash}
        [Stellar]>>> %undefine foo
        [Stellar]>>> %globals
        {baz=bash}
        ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nickwallen/metron METRON-1167

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/740.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #740
    
----
commit dd91135a551a493ae9823db673c485824f2fe20c
Author: Nick Allen <n...@nickallen.org>
Date:   2017-09-07T22:58:58Z

    METRON-1167 Define Session Specific Global Configuration Values in the REPL

----


---

Reply via email to