brooklyn.event.feed.http
[Java] Class HttpFeed
java.lang.Object
   brooklyn.event.feed.AbstractFeed
brooklyn.event.feed.AbstractFeed
       brooklyn.event.feed.http.HttpFeed
brooklyn.event.feed.http.HttpFeed
public class HttpFeed
extends AbstractFeed
 Provides a feed of attribute values, by polling over http.
 
 Example usage (e.g. in an entity that extends SoftwareProcessImpl):
 
 private HttpFeed feed;
 
 //@Override
 protected void connectSensors() {
   super.connectSensors();
   
   feed = HttpFeed.builder()
       .entity(this)
       .period(200)
       .baseUri(String.format("http://%s:%s/management/subsystem/web/connector/http/read-resource", host, port))
       .baseUriVars(ImmutableMap.of("include-runtime","true"))
       .poll(new HttpPollConfig(SERVICE_UP)
           .onSuccess(HttpValueFunctions.responseCodeEquals(200))
           .onError(Functions.constant(false)))
       .poll(new HttpPollConfig(REQUEST_COUNT)
           .onSuccess(HttpValueFunctions.jsonContents("requestCount", Integer.class)))
       .build();
 
 
 {- literal:
- @}Override
 protected void disconnectSensors() {
   super.disconnectSensors();
   if (feed != null) feed.stop();
 }
 }
 
 
  
 This also supports giving a Supplier for the URL 
 (e.g. Entities#attributeSupplier(brooklyn.entity.Entity, brooklyn.event.AttributeSensor))
 from a sensor.  Note however that if a Supplier-based sensor is *https*,
 https-specific initialization may not occur if the URL is not available at start time,
 and it may report errors if that sensor is not available.
 Some guidance for controlling enablement of a feed based on availability of a sensor
 can be seen in HttpLatencyDetector (in brooklyn-policy). 
- Authors:
- aled
    
     
    
     
                 
    
     
                | Methods inherited from class AbstractFeed | 
|---|
                | getEntity, isActivated, isActive, isConnected, postStop, preStart, preStop, resume, start, stop, suspend | 
                
                 
    
    
        log
        public static final Logger log
        
        - 
        
        
    
     
    
    
        
        HttpFeed
        protected java.lang.Object HttpFeed(HttpFeed.Builder builder)
        
        - 
        
        
    
        
        builder
        public static HttpFeed.Builder builder()
        
        - 
        
        
    
        
        preStart
        protected void preStart() {
protected void preStart()
        
        - 
        
        
    
     
Brooklyn Multi-Cloud Application Management Platform 
 brooklyncentral.github.com. Apache License. © 2012.