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 Mon, 20 Mar 2017 20:02:24 GMT
Github user mikewalch commented on a diff in the pull request:

    https://github.com/apache/incubator-fluo/pull/817#discussion_r106990516
  
    --- 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 [ObserversFactory] 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 AppObserversFactory implements ObserversFactory {
           @Override
    -      public ObservedColumn getObservedColumn() {
    -        return new ObservedColumn(new Column("obs", "data"), NotificationType.STRONG);
    +      public void createObservers(ObserverConsumer obsConsumer, Context ctx) {
    +        //setup InvertObserver to be triggered when the column obs:data is modified
    +        obsConsumer.accept(new Column("obs", "data"), 
    +                           NotificationType.STRONG,
    +                           new InvertObserver());
    +        
    +        //Observer is a Functional interface.  So Obsevers can be written as lambdas.
    +        obsConcumer.accept(new Column("new","data"),
    +                           NotificationType.WEAK,
    +                           (tx,row,col) -> { 
    --- End diff --
    
    Very nice to have a functional interface now


---
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.
---

Mime
View raw message