[GitHub] brooklyn-docs issue #159: Add docs for enricher.producer values

2017-03-30 Thread mikezaccardo
Github user mikezaccardo commented on the issue:

https://github.com/apache/brooklyn-docs/pull/159
  
@geomacy I will create a separate enrichers page in a new PR.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (BROOKLYN-458) Cluster can't use transformer to get "host.name" sensor of "cluster.first.entity"

2017-03-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/BROOKLYN-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15949365#comment-15949365
 ] 

ASF GitHub Bot commented on BROOKLYN-458:
-

Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-docs/pull/159


> Cluster can't use transformer to get "host.name" sensor of 
> "cluster.first.entity"
> -
>
> Key: BROOKLYN-458
> URL: https://issues.apache.org/jira/browse/BROOKLYN-458
> Project: Brooklyn
>  Issue Type: Improvement
>Reporter: Aled Sage
>
> Mike shared the blueprint below (which I've turned into a unit test, against 
> 0.11.0-SNAPSHOT):
> {noformat}
> @Test
> public void testClusterGetsAttributeOfChild() throws Exception {
> String yaml = Joiner.on("\n").join(
> "brooklyn.catalog:",
> "version: 0.2-SNAPSHOT",
> "items:",
> "- id: test-cluster",
> "  name: test-cluster",
> "  item:",
> "type: 
> org.apache.brooklyn.entity.group.DynamicCluster",
> "memberSpec:",
> "  $brooklyn:entitySpec:",
> "type: 
> org.apache.brooklyn.entity.software.base.EmptySoftwareProcess",
> "name: \"Node\"",
> "brooklyn.enrichers:",
> "  - type: 
> org.apache.brooklyn.enricher.stock.Transformer",
> "brooklyn.config:",
> "  enricher.sourceSensor: 
> $brooklyn:sensor(\"cluster.first.entity\")",
> "  enricher.targetSensor: 
> $brooklyn:sensor(\"cluster_first_host\")",
> "  enricher.targetValue:",
> "$brooklyn:formatString:",
> "- \"%s\"",
> "- 
> $brooklyn:entity($brooklyn:attributeWhenReady(\"cluster.first.entity\")).attributeWhenReady(\"host.name\")");
> addCatalogItems(yaml);
> 
> String appYaml = Joiner.on("\n").join(
> "location: localhost",
> "services:",
> "- type: test-cluster");
> 
> Entity app = createAndStartApplication(appYaml);
> Entity cluster = Iterables.getOnlyElement(app.getChildren());
> 
> EntityAsserts.assertAttributeEqualsEventually(app, 
> Attributes.SERVICE_UP, true);
> EntityAsserts.assertAttributeEqualsEventually(app, 
> Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
> EntityAsserts.assertAttributeEventually(cluster, 
> Sensors.newStringSensor("cluster_first_host"), StringPredicates.isNonBlank());
> }
> {noformat}
> It fails because sensor {{cluster_first_host}} is never set on the cluster 
> entity. This is because the targetValue evaluation is triggered whenever the 
> sourceSensor changes. However, when {{clsuter.first.entity}} is set, that 
> entity does not yet have a {{host.name}}. Therefore the 
> {{attributeWhenReady}} is not yet available. (Under-the-covers, it discovers 
> this by using {{getImmediately}}, and thus returns immediately without 
> blocking).
> Mike tried to work around this by setting the {{producer}} for the 
> transformer enricher, but that led to him hitting 
> https://issues.apache.org/jira/browse/BROOKLYN-457.
> This is not really a bug (but could probably do with improvements in our docs 
> to explain it!).
> We'd like a way to elegantly write this blueprint though (hence marking this 
> as an "improvement").



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-docs/pull/159


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread mikezaccardo
Github user mikezaccardo commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108973986
  
--- Diff: guide/java/policies.md ---
@@ -200,8 +200,8 @@ Converts absolute sensor values into a delta.
 - org.apache.brooklyn.enricher.stock.YamlTimeWeightedDeltaEnricher
 
 Converts absolute sensor values into a delta/second.
-   
-{% highlight yaml %}
+
+{% highlight yaml %}2
--- End diff --

Looks like a go to line command snuck in there...


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread drigodwin
Github user drigodwin commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108972314
  
--- Diff: guide/java/policies.md ---
@@ -200,8 +200,8 @@ Converts absolute sensor values into a delta.
 - org.apache.brooklyn.enricher.stock.YamlTimeWeightedDeltaEnricher
 
 Converts absolute sensor values into a delta/second.
-   
-{% highlight yaml %}
+
+{% highlight yaml %}2
--- End diff --

is this `2` a typo?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread mikezaccardo
Github user mikezaccardo commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108968770
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
+enricher that has an `enricher.sourceSensor` value that comes from an 
entity that is different from the entity on which the
+enricher is defined.
+
+For example, if we consider the Transfomer from above, suppose that 
`enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list")`
+is actually a sensor on a different entity called `load.balancer`. In this 
case, we would need to supploy an
+`enricher.producer` value.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Transformer
+  brooklyn.config:
+enricher.producer: brooklyn:entity("load.balancer")
--- End diff --

(facepalm)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread mikezaccardo
Github user mikezaccardo commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108968331
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
--- End diff --

Thanks a lot -- I was struggling to write that paragraph in a clear way and 
felt as thought it was a tough read as well.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #158: Minor fix to Azure ARM docs

2017-03-30 Thread nakomis
Github user nakomis closed the pull request at:

https://github.com/apache/brooklyn-docs/pull/158


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (BROOKLYN-460) Brooklyn Camp syntax for adding tags to an entity spec

2017-03-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/BROOKLYN-460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15948733#comment-15948733
 ] 

ASF GitHub Bot commented on BROOKLYN-460:
-

Github user geomacy commented on the issue:

https://github.com/apache/brooklyn-server/pull/612
  
Given that there's lots of discussion above, can I +1 the suggestion by 
@m4rkmckenna to take this to the mailing list as a proposal and invite 
discussion there?


> Brooklyn Camp syntax for adding tags to an entity spec
> --
>
> Key: BROOKLYN-460
> URL: https://issues.apache.org/jira/browse/BROOKLYN-460
> Project: Brooklyn
>  Issue Type: New Feature
>Reporter: Valentin Aitken
>Priority: Minor
>
> Current requirement is to be able to supply String tags in an entity spec in 
> YAML so it can be then retrieved via REST API with {{GET 
> /v1/applications//entities//tags}}.
> Example usage in a YAML blueprint:
> {noformat}
> services:
> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
>   brooklyn.tags:
>   - tag1
>   - tag2
> {noformat}
> Please shout if you have further requirements for {{brooklyn.tags}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] brooklyn-server issue #612: BROOKLYN-460: Brooklyn Camp syntax for adding ta...

2017-03-30 Thread geomacy
Github user geomacy commented on the issue:

https://github.com/apache/brooklyn-server/pull/612
  
Given that there's lots of discussion above, can I +1 the suggestion by 
@m4rkmckenna to take this to the mailing list as a proposal and invite 
discussion there?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108871926
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
+enricher that has an `enricher.sourceSensor` value that comes from an 
entity that is different from the entity on which the
+enricher is defined.
+
+For example, if we consider the Transfomer from above, suppose that 
`enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list")`
+is actually a sensor on a different entity called `load.balancer`. In this 
case, we would need to supploy an
+`enricher.producer` value.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Transformer
+  brooklyn.config:
+enricher.producer: brooklyn:entity("load.balancer")
--- End diff --

You're missing the `$` in front of `brooklyn:`.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108874111
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
+enricher that has an `enricher.sourceSensor` value that comes from an 
entity that is different from the entity on which the
+enricher is defined.
+
+For example, if we consider the Transfomer from above, suppose that 
`enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list")`
+is actually a sensor on a different entity called `load.balancer`. In this 
case, we would need to supploy an
+`enricher.producer` value.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Transformer
+  brooklyn.config:
+enricher.producer: brooklyn:entity("load.balancer")
+enricher.sourceSensor: $brooklyn:sensor("urls.tcp.string")
+enricher.targetSensor: $brooklyn:sensor("urls.tcp.withBrackets")
+enricher.targetValue: $brooklyn:formatString("[%s]", 
$brooklyn:attributeWhenReady("urls.tcp.string"))
+{% endhighlight %}
+
+It is important to note that the value supplied to `enricher.producer` 
must be immediately resolvable. While it would be valid
+DSL syntax to write `enricher.producer: 
brooklyn:entity($brooklyn:attributeWhenReady("load.balancer.entity"))` 
(assuming the
--- End diff --

Use {% highlight yaml %} for this for cleaner presentation.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108873963
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
+enricher that has an `enricher.sourceSensor` value that comes from an 
entity that is different from the entity on which the
+enricher is defined.
+
+For example, if we consider the Transfomer from above, suppose that 
`enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list")`
+is actually a sensor on a different entity called `load.balancer`. In this 
case, we would need to supploy an
--- End diff --

Typo "supploy"


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108873830
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
+enricher that has an `enricher.sourceSensor` value that comes from an 
entity that is different from the entity on which the
+enricher is defined.
+
+For example, if we consider the Transfomer from above, suppose that 
`enricher.sourceSensor: $brooklyn:sensor("urls.tcp.list")`
+is actually a sensor on a different entity called `load.balancer`. In this 
case, we would need to supploy an
+`enricher.producer` value.
+
+{% highlight yaml %}
+brooklyn.enrichers:
+- type: org.apache.brooklyn.enricher.stock.Transformer
+  brooklyn.config:
+enricher.producer: brooklyn:entity("load.balancer")
+enricher.sourceSensor: $brooklyn:sensor("urls.tcp.string")
+enricher.targetSensor: $brooklyn:sensor("urls.tcp.withBrackets")
+enricher.targetValue: $brooklyn:formatString("[%s]", 
$brooklyn:attributeWhenReady("urls.tcp.string"))
--- End diff --

Could we break this line to avoid having to scroll right on the docs page 
just to read it? Is the following ok?
```
enricher.targetValue: |
  $brooklyn:formatString("[%s]", 
$brooklyn:attributeWhenReady("urls.tcp.string"))
```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108867638
  
--- Diff: guide/dev/tips/index.md ---
@@ -39,21 +39,32 @@ title: Miscellaneous Tips and Tricks
   sensors and config keys can be re-used.
   (Many are inherited from interfaces, where they are declared as 
constants,
   e.g. ``Attributes`` and ``UsesJmx``.)
-  
+
 * Understand the location hierarchy:  software process entities typically 
get an ``SshMachineLocation``,
   and use a ``*SshDriver`` to do what they need.  This will usually have a 
``MachineProvisioningLocation`` parent, e.g. a
   ``JcloudsLocation`` (e.g. AWS eu-west-1 with credentials) or possibly a 
``LocalhostMachineProvisioningLocation``.
   Clusters will take such a ``MachineProvisioningLocation`` (or a 
singleton list); fabircs take a list of locations.
   Some PaaS systems have their own location model, such as 
``OpenShiftLocation``.
 
-Finally, don't be shy about [talking with 
others]({{site.path.website}}/community/), 
-that's far better than spinning your wheels (or worse, having a bad 
experience),
-plus it means we can hopefully improve things for other people!
+* Finally, don't be shy about [talking with 
others]({{site.path.website}}/community/),
+  that's far better than spinning your wheels (or worse, having a bad 
experience),
+  plus it means we can hopefully improve things for other people!
 
+## YAML Blueprint Debugging
+
+* Brooklyn will reject any YAML blueprint that contains syntax errors and 
will alert the user of such errors.
+
+* However, it is possible to create a blueprint that is syntactically 
legal but results in runtime problems
+  for Brooklyn (for example, if an enricher's `enricher.producer` value is 
not immediately resolvable).
+
+* If Brooklyn misbehaves or freezes after deploying a blueprint, run the 
`jstack ` command to view
--- End diff --

I wouldn't use 'misbehaves' here.  How about just "If Brooklyn appears to 
freeze"?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread geomacy
Github user geomacy commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/159#discussion_r108871638
  
--- Diff: guide/java/policies.md ---
@@ -235,6 +235,30 @@ An Enricher which computes latency in accessing a URL.
 Can be used to combine the values of sensors.  This enricher should be 
instantiated using Enrichers.buider.combining(..).
 This enricher is only available in Java blueprints and cannot be used in 
YAML.
 
+ Note On Enricher Producers
+
+`enricher.producer: brooklyn:entity("entity.id.here")` is a 
`brooklyn.config` key/value pair that should be supplied to any
--- End diff --

I found this paragraph a bit hard to parse at first read!  Maybe just 
something like 

> If an entity needs an enricher whose source sensor  
(`enricher.sourceSensor`) belongs
> to another entity, then the enricher configuration must include an 
`enricher.producer` 
> key referring to the other entity.
>
> For example...
```



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #159: Add docs for enricher.producer values

2017-03-30 Thread mikezaccardo
GitHub user mikezaccardo opened a pull request:

https://github.com/apache/brooklyn-docs/pull/159

Add docs for enricher.producer values

Adds documentation to address the problem described by 
https://issues.apache.org/jira/browse/BROOKLYN-458.

Questions for reviewers: 

* Should the "Enrichers" list be moved to its own page entirely, rather 
than being on the "Policies" page?
* Should the workaround listed in 
https://issues.apache.org/jira/browse/BROOKLYN-458 be included in the docs?

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

$ git pull https://github.com/mikezaccardo/brooklyn-docs 
add-enricher-producer-docs

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

https://github.com/apache/brooklyn-docs/pull/159.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 #159


commit 450f0ac844b863e3cc56c75609ffd37c4a6fb686
Author: Mike Zaccardo 
Date:   2017-03-30T07:27:54Z

Add docs for enricher.producer values




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (BROOKLYN-458) Cluster can't use transformer to get "host.name" sensor of "cluster.first.entity"

2017-03-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/BROOKLYN-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15948568#comment-15948568
 ] 

ASF GitHub Bot commented on BROOKLYN-458:
-

GitHub user mikezaccardo opened a pull request:

https://github.com/apache/brooklyn-docs/pull/159

Add docs for enricher.producer values

Adds documentation to address the problem described by 
https://issues.apache.org/jira/browse/BROOKLYN-458.

Questions for reviewers: 

* Should the "Enrichers" list be moved to its own page entirely, rather 
than being on the "Policies" page?
* Should the workaround listed in 
https://issues.apache.org/jira/browse/BROOKLYN-458 be included in the docs?

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

$ git pull https://github.com/mikezaccardo/brooklyn-docs 
add-enricher-producer-docs

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

https://github.com/apache/brooklyn-docs/pull/159.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 #159


commit 450f0ac844b863e3cc56c75609ffd37c4a6fb686
Author: Mike Zaccardo 
Date:   2017-03-30T07:27:54Z

Add docs for enricher.producer values




> Cluster can't use transformer to get "host.name" sensor of 
> "cluster.first.entity"
> -
>
> Key: BROOKLYN-458
> URL: https://issues.apache.org/jira/browse/BROOKLYN-458
> Project: Brooklyn
>  Issue Type: Improvement
>Reporter: Aled Sage
>
> Mike shared the blueprint below (which I've turned into a unit test, against 
> 0.11.0-SNAPSHOT):
> {noformat}
> @Test
> public void testClusterGetsAttributeOfChild() throws Exception {
> String yaml = Joiner.on("\n").join(
> "brooklyn.catalog:",
> "version: 0.2-SNAPSHOT",
> "items:",
> "- id: test-cluster",
> "  name: test-cluster",
> "  item:",
> "type: 
> org.apache.brooklyn.entity.group.DynamicCluster",
> "memberSpec:",
> "  $brooklyn:entitySpec:",
> "type: 
> org.apache.brooklyn.entity.software.base.EmptySoftwareProcess",
> "name: \"Node\"",
> "brooklyn.enrichers:",
> "  - type: 
> org.apache.brooklyn.enricher.stock.Transformer",
> "brooklyn.config:",
> "  enricher.sourceSensor: 
> $brooklyn:sensor(\"cluster.first.entity\")",
> "  enricher.targetSensor: 
> $brooklyn:sensor(\"cluster_first_host\")",
> "  enricher.targetValue:",
> "$brooklyn:formatString:",
> "- \"%s\"",
> "- 
> $brooklyn:entity($brooklyn:attributeWhenReady(\"cluster.first.entity\")).attributeWhenReady(\"host.name\")");
> addCatalogItems(yaml);
> 
> String appYaml = Joiner.on("\n").join(
> "location: localhost",
> "services:",
> "- type: test-cluster");
> 
> Entity app = createAndStartApplication(appYaml);
> Entity cluster = Iterables.getOnlyElement(app.getChildren());
> 
> EntityAsserts.assertAttributeEqualsEventually(app, 
> Attributes.SERVICE_UP, true);
> EntityAsserts.assertAttributeEqualsEventually(app, 
> Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
> EntityAsserts.assertAttributeEventually(cluster, 
> Sensors.newStringSensor("cluster_first_host"), StringPredicates.isNonBlank());
> }
> {noformat}
> It fails because sensor {{cluster_first_host}} is never set on the cluster 
> entity. This is because the targetValue evaluation is triggered whenever the 
> sourceSensor changes. However, when {{clsuter.first.entity}} is set, that 
> entity does not yet have a {{host.name}}. Therefore the 
> {{attributeWhenReady}} is not yet available. (Under-the-covers, it discovers 
> this by using {{getImmediately}}, and thus returns immediately without 
> blocking).
> Mike tried to work around this by setting the {{producer}} for the 
> transformer enricher, but that led to him hitting 
> https://issues.apache.org/jira/browse/BROOKLYN-457.
> This is not really a bug (but could probably do with improvements in our docs 
> to explain it!).
> We'd like a way to elegantly write this blueprint though (hence marking this 
> as an "improvement").



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)