GitHub user robertgmoss opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/919

    Allow sensors to be aggregated using a Reducer

    Combines sensors using a function and publishes into a target sensor, e.g
    
    ```
    location: localhost
    services:
    - type: org.apache.brooklyn.entity.stock.BasicApplication
    
      brooklyn.enrichers:
      - type: org.apache.brooklyn.enricher.stock.reducer.StringStringReducer
        brooklyn.config:
          enricher.sourceSensors:
          - $brooklyn:sensor("first.name")
          - $brooklyn:sensor("last.name")
          enricher.targetSensor:
            $brooklyn:sensor("full.name")
          enricher.reducerFunction.untyped: formatString
          enricher.reducerFunction.parameters:
            format: "%s %s"
    
      brooklyn.initializers:
      - type: brooklyn.entity.software.StaticSensor
        brooklyn.config:
          name: first.name
          targetType: String
          static.value: Foo
      - type: brooklyn.entity.software.StaticSensor
        brooklyn.config:
          name: last.name
          targetType: String
          static.value: Bar
    ```

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

    $ git pull https://github.com/robertgmoss/incubator-brooklyn 
reducer-enricher-additions

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

    https://github.com/apache/incubator-brooklyn/pull/919.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 #919
    
----
commit 0285da829e69a9003cd4b74a21fe207cce851a02
Author: Martin Harris <[email protected]>
Date:   2015-09-22T13:56:02Z

    Adds reducer enricher

commit f592da401a0d29dd11b1a5a2b9048ff6c5996804
Author: Robert Moss <[email protected]>
Date:   2015-09-23T11:24:24Z

    add generic type reducer and tests

commit d9f8c33ad9367b67897d40ad21865fa9a4e6cb13
Author: Robert Moss <[email protected]>
Date:   2015-09-23T13:16:47Z

    adds formatString function

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to