hi Graham,

did you ever get anywhere with this?   I tried out doing what I think you
mean and it seemed to work for me, just copying the definitions you gave in
your email, and picking Tomcat as the example cluster member type, as I
don't know what you are using - I substituted "http.port" for "ca.port".

Here is my complete blueprint

location: aws-ireland
name: test1
services:

- id: testcluster
  type: cluster
  initialSize: 2
  memberSpec:
    $brooklyn:entitySpec:
      type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
      name: Tomcat
      war: https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war
      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("http.port"))

  brooklyn.enrichers:

    - 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


This deploys without anything hanging, and the "cm_host_port_list" gets
populated as you'd expect:

[
  "ec2-54-246-234-162.eu-west-1.compute.amazonaws.com:8080",
  "ec2-54-171-51-13.eu-west-1.compute.amazonaws.com:8080"
]


Is this like what you're doing, but it's hanging still for you?

cheers
Geoff

On Wed, 10 May 2017 at 22:41 Valentin Aitken <
[email protected]> wrote:

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

Reply via email to