fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikewalch <...@git.apache.org>
Subject [GitHub] incubator-fluo pull request #817: fixes #816 introduced better way to setup ...
Date Wed, 22 Mar 2017 16:46:31 GMT
Github user mikewalch commented on a diff in the pull request:

    --- Diff: docs/applications.md ---
    @@ -114,25 +114,45 @@ To create an observer, follow these steps:
             // invert row and value
             tx.set(value, new Column("inv", "data"), row);
    +    }
    +    ```
    +2.  Create a class that implements [ObserverProvider] like the example below.  The purpose
of this
    +    class is associate a set Observers with columns that trigger the observers.  The
class can
    +    create multiple observers.
    +    ```java
    +    class AppObserverProvider implements ObserverProvider {
    -      public ObservedColumn getObservedColumn() {
    -        return new ObservedColumn(new Column("obs", "data"), NotificationType.STRONG);
    +      public void provide(Registry or, Context ctx) {
    +        //setup InvertObserver to be triggered when the column obs:data is modified
    +        or.register(new Column("obs", "data"),
    +                           NotificationType.STRONG,
    +                           new InvertObserver());
    +        //Observer is a Functional interface.  So Obsevers can be written as lambdas.
    +        or.register(new Column("new","data"),
    +                           NotificationType.WEAK,
    +                           (tx,row,col) -> { 
    +                             Bytes combined = combineNewAndOld(tx,row);
    +                             tx.set(row, new Column("current","data"), combined);
    +                           });
    -2.  Build a jar containing this class and include this jar in the `lib/` directory of
your Fluo
    +3.  Build a jar containing thses classes and include this jar in the `lib/` directory
of your Fluo
    -3.  Configure your Fluo instance to use this observer by modifying the Observer section
    +4.  Configure your Fluo instance to use this observer factory by modifying the Observer
section of
    --- End diff --
    should be `observer provider`

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message