brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Valentin Aitken <valentin.ait...@cloudsoftcorp.com>
Subject Re: How to Transform host.name
Date Wed, 10 May 2017 21:41:03 GMT
Hi,

What about using a customize.latch ? [1]

Example:
  customize.latch:
$brooklyn:entity("myClusterId").attributeWhenReady("cm_host_port_list"
)

[1] https://brooklyn.apache.org/v/latest/yaml/advanced-example.html#lat
ches

VA.

On Wed, 2017-05-10 at 17:30 -0400, Graham Ashby wrote:
> I have a list defined in a cluster:
> 
>     - type: org.apache.brooklyn.enricher.stock.Aggregator
>       brooklyn.config:
>         enricher.sourceSensor: $brooklyn:sensor("cm_host_port")
>         enricher.targetSensor: $brooklyn:sensor("cm_host_port_list")
>         enricher.aggregating.fromMembers: true
> 
> I'd like to use that list when I customize the entity. 
> 
> The issue is creating the "cm_host_port" in the entity.  I've tried 
> various combinations.  This works, but doesn't get the sensor
> created 
> until too late:
> 
>     brooklyn.enrichers:
>       - type: org.apache.brooklyn.enricher.stock.Transformer
>         brooklyn.config:
>           enricher.sourceSensor: $brooklyn:sensor("service.isUp")
>           enricher.targetSensor: $brooklyn:sensor("cm_host_port")
>           enricher.targetValue: $brooklyn:formatString("%s:%s", 
> $brooklyn:attributeWhenReady("host.name"), 
> $brooklyn:attributeWhenReady("ca.port"))
> 
> If I change the sourceSensor to:
>          enricher.sourceSensor: $brooklyn:sensor("host.name")
> or
>          enricher.sourceSensor:
> $brooklyn:attributeWhenReady("host.name")
> 
> Then the entity hangs, waiting for host.name to be set.
> 
> I tried:
>           enricher.triggerSensors:
>           - $brooklyn:sensor("host.name")
> 
> But that never got triggered.
> (BTW, I cant find "triggerSensors" in the code)
> 
> Any Idea how I can fix this without doing something in my Java code?
> 
> Thanks
> Graham Ashby
> 

Mime
View raw message