@Beta public class OnPublicNetworkEnricher extends AbstractOnNetworkEnricher
PortForwardManager
). This can be used with sensors of type URI, HostAndPort
or plain integer port values. The port-mappings is retrieved by looking up the entity's machine
and the private port, in the PortForwardManager
's recorded port-mappings.
For example, to configure each Tomcat node to publish its mapped uri, and to use that sensor
in Nginx for the target servers:
services:
- type: cluster
id: cluster
brooklyn.config:
memberSpec:
$brooklyn:entitySpec:
type: org.apache.brooklyn.entity.webapp.tomcat.TomcatServer
brooklyn.enrichers:
- type: org.apache.brooklyn.core.network.OnPublicNetworkEnricher
brooklyn.config:
sensor: main.uri
- type: org.apache.brooklyn.entity.proxy.nginx.NginxController
brooklyn.config:
member.sensor.hostandport: $brooklyn:sensor("main.uri.mapped.public")
serverPool: cluster
AbstractOnNetworkEnricher.SensorNameConverter
AbstractEntityAdjunct.AdjunctTagSupport, AbstractEntityAdjunct.BasicSubscriptionSupport
BrooklynObject.RelationSupport<T extends BrooklynObject>, BrooklynObject.SubscriptionSupport, BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal, BrooklynObjectInternal.RelationSupportInternal<T extends BrooklynObject>, BrooklynObjectInternal.SubscriptionSupportInternal
Modifier and Type | Field and Description |
---|---|
static ConfigKey<AttributeSensor<java.lang.String>> |
ADDRESS_SENSOR |
static ConfigKey<PortForwardManager> |
PORT_FORWARD_MANAGER |
static ConfigKey<com.google.common.base.Function<? super java.lang.String,java.lang.String>> |
SENSOR_NAME_CONVERTER |
MAP_MATCHING, SENSORS
SUPPRESS_DUPLICATES
Constructor and Description |
---|
OnPublicNetworkEnricher() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Unsubscribes and clears all managed subscriptions; is called by the owning entity when a policy is removed
and should always be called by any subclasses overriding this method
|
void |
setEntity(EntityLocal entity) |
getEnricherType, getRebindSupport, relations
config, configure, getAdjunctType, getConfig, getDisplayName, getEntity, getUniqueTag, isDestroyed, isRunning, setConfig, setDisplayName, subscribe, subscribeToChildren, subscribeToMembers, subscriptions, tags, toString, unsubscribe, unsubscribe
getCatalogItemId, getId, getManagementContext, init, rebind, setCatalogItemId, setManagementContext
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getUniqueTag, isDestroyed, isRunning
getCatalogItemId, getDisplayName, subscriptions, tags
config, getConfig, setConfig
setCatalogItemId
public static ConfigKey<com.google.common.base.Function<? super java.lang.String,java.lang.String>> SENSOR_NAME_CONVERTER
public static final ConfigKey<PortForwardManager> PORT_FORWARD_MANAGER
public static final ConfigKey<AttributeSensor<java.lang.String>> ADDRESS_SENSOR
public void setEntity(EntityLocal entity)
setEntity
in class AbstractOnNetworkEnricher
public void destroy()
AbstractEntityAdjunct
destroy
in class AbstractEntityAdjunct