Package org.apache.activemq.broker
Class PublishedAddressPolicy
- java.lang.Object
-
- org.apache.activemq.broker.PublishedAddressPolicy
-
public class PublishedAddressPolicy extends Object
Policy object that controls how a TransportConnector publishes the connector's address to the outside world. By default the connector will publish itself using the resolved host name of the bound server socket.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PublishedAddressPolicy.PublishedHostStrategy
Defines the value of the published host value.
-
Constructor Summary
Constructors Constructor Description PublishedAddressPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getClusterClientUriQuery()
Gets the URI query that's configured on the published URI that's sent to client's when the cluster info is updated.Map<String,String>
getHostMapping()
Map<Integer,Integer>
getPortMapping()
String
getPublishableConnectString(TransportConnector connector)
URI
getPublishableConnectURI(TransportConnector connector)
Using the supplied TransportConnector this method returns the String that will be used to update clients with this connector's connect address.protected String
getPublishedFragmentValue(String uriFragmentEntry)
Subclasses can override what host value is published by implementing alternate logic for this method.PublishedAddressPolicy.PublishedHostStrategy
getPublishedHostStrategy()
protected String
getPublishedHostValue(String uriHostEntry)
Subclasses can override what host value is published by implementing alternate logic for this method.protected String
getPublishedPathValue(String uriPathEntry)
Subclasses can override what path value is published by implementing alternate logic for this method.protected String
getPublishedUserInfoValue(String uriUserInfoEntry)
Subclasses can override what user info value is published by implementing alternate logic for this method.void
setClusterClientUriQuery(String clusterClientUriQuery)
Sets the URI query that's configured on the published URI that's sent to client's when the cluster info is updated.void
setHostMapping(Map<String,String> hostMapping)
void
setPortMapping(Map<Integer,Integer> portMapping)
void
setPublishedHostStrategy(String strategy)
void
setPublishedHostStrategy(PublishedAddressPolicy.PublishedHostStrategy strategy)
-
-
-
Method Detail
-
getPublishableConnectURI
public URI getPublishableConnectURI(TransportConnector connector) throws Exception
Using the supplied TransportConnector this method returns the String that will be used to update clients with this connector's connect address.- Parameters:
connector
- The TransportConnector whose address is to be published.- Returns:
- a string URI address that a client can use to connect to this Transport.
- Throws:
Exception
-
getPublishableConnectString
public String getPublishableConnectString(TransportConnector connector) throws Exception
- Throws:
Exception
-
getPublishedHostValue
protected String getPublishedHostValue(String uriHostEntry) throws UnknownHostException
Subclasses can override what host value is published by implementing alternate logic for this method.- Parameters:
uriHostEntry
-- Returns:
- the value published for the given host.
- Throws:
UnknownHostException
-
getPublishedPathValue
protected String getPublishedPathValue(String uriPathEntry)
Subclasses can override what path value is published by implementing alternate logic for this method. By default this method simply returns what was already set as the Path value in the original URI.- Parameters:
uriPathEntry
- The original value of the URI path.- Returns:
- the desired value for the published URI's path.
-
getPublishedFragmentValue
protected String getPublishedFragmentValue(String uriFragmentEntry)
Subclasses can override what host value is published by implementing alternate logic for this method. By default this method simply returns what was already set as the Fragment value in the original URI.- Parameters:
uriFragmentEntry
- The original value of the URI Fragment.- Returns:
- the desired value for the published URI's Fragment.
-
getPublishedUserInfoValue
protected String getPublishedUserInfoValue(String uriUserInfoEntry)
Subclasses can override what user info value is published by implementing alternate logic for this method. By default this method simply returns what was already set as the UserInfo value in the original URI.- Parameters:
uriUserInfoEntry
- The original value of the URI user info.- Returns:
- the desired value for the published URI's user info.
-
getClusterClientUriQuery
public String getClusterClientUriQuery()
Gets the URI query that's configured on the published URI that's sent to client's when the cluster info is updated.- Returns:
- the clusterClientUriQuery
-
setClusterClientUriQuery
public void setClusterClientUriQuery(String clusterClientUriQuery)
Sets the URI query that's configured on the published URI that's sent to client's when the cluster info is updated.- Parameters:
clusterClientUriQuery
- the clusterClientUriQuery to set
-
getPublishedHostStrategy
public PublishedAddressPolicy.PublishedHostStrategy getPublishedHostStrategy()
- Returns:
- the publishedHostStrategy
-
setPublishedHostStrategy
public void setPublishedHostStrategy(PublishedAddressPolicy.PublishedHostStrategy strategy)
- Parameters:
strategy
- the publishedHostStrategy to set
-
setPublishedHostStrategy
public void setPublishedHostStrategy(String strategy)
- Parameters:
strategy
- the publishedHostStrategy to set
-
setPortMapping
public void setPortMapping(Map<Integer,Integer> portMapping)
- Parameters:
portMapping
- map the ports in restrictive environments
-
setHostMapping
public void setHostMapping(Map<String,String> hostMapping)
- Parameters:
hostMapping
- map the resolved hosts
-
-