public class Router extends Object
Membrane Service Proxy's main object.
The router is a Spring Lifecycle object: It is automatically started and stopped according to the Lifecycle of the Spring Context containing it. In Membrane's standard setup (standalone or in a J2EE web app), Membrane itself controls the creation of the Spring Context and its Lifecycle.
In this case, the router is hot deployable: It can monitor proxies.xml, the Spring configuration file, for changes and reinitialize the Spring Context, when a change is detected. Note that, during the Spring Context restart, the router object itself along with almost all other Membrane objects (interceptors, etc.) will be recreated.
| Modifier and Type | Field and Description |
|---|---|
protected ExecutorService |
backgroundInitializator |
protected DNSCache |
dnsCache |
protected ExchangeStore |
exchangeStore |
protected String |
jmxRouterName |
protected ResolverMap |
resolverMap |
protected RuleManager |
ruleManager |
protected Statistics |
statistics |
protected Transport |
transport |
protected URIFactory |
uriFactory |
| Constructor and Description |
|---|
Router() |
protected RuleManager ruleManager
protected ExchangeStore exchangeStore
protected Transport transport
protected ResolverMap resolverMap
protected DNSCache dnsCache
protected ExecutorService backgroundInitializator
protected URIFactory uriFactory
protected Statistics statistics
protected String jmxRouterName
public Collection<Rule> getRules()
public void setRules(Collection<Rule> proxies)
public static Router init(String configFileName) throws MalformedURLException
MalformedURLExceptionpublic static Router init(String resource, ClassLoader classLoader)
public RuleManager getRuleManager()
public void setRuleManager(RuleManager ruleManager)
public ExchangeStore getExchangeStore()
public void setExchangeStore(ExchangeStore exchangeStore)
LimitedMemoryExchangeStore limited to the size of 1 MB.ExchangeStore. The exchange store will be used by this router's
components (AdminConsoleInterceptor, ExchangeStoreInterceptor, etc.) by default, if
no other exchange store is explicitly set to be used by them.public Transport getTransport()
public void setTransport(Transport transport)
public HttpClientConfiguration getHttpClientConfig()
public void setHttpClientConfig(HttpClientConfiguration httpClientConfig)
public DNSCache getDnsCache()
public ResolverMap getResolverMap()
public void shutdown()
throws IOException
IOException@Deprecated public void shutdownNoWait() throws IOException
shutdown(). "Not waiting" is not supported anymore, as open connections can
now be forcibly closed after a timeout. See
HttpTransport.setForceSocketCloseOnHotDeployAfter(int).IOExceptionpublic ExecutorService getBackgroundInitializator()
public Rule getParentProxy(Interceptor interceptor)
public void add(Rule rule) throws IOException
IOExceptionpublic void start()
public void tryReinitialization()
public void stop()
public boolean isRunning()
public int getRetryInitInterval()
public void setRetryInitInterval(int retryInitInterval)
public String getBaseLocation()
public void setBaseLocation(String baseLocation)
public boolean isRetryInit()
public void setRetryInit(boolean retryInit)
Whether the router should continue startup, if initialization of a rule (proxy, serviceProxy or soapProxy) failed (for example, when a WSDL a component depends on could not be downloaded).
If false, the router will exit with code -1 just after startup, when the initialization of a rule failed.
If true, the router will continue startup, and all rules which could not be initialized will be inactive (=not
Rule.isActive()).
Inactive rules will simply be ignored for routing decissions for incoming requests. This means that requests for inactive rules might be routed using different routes or result in a "400 Bad Request" when no active route could be matched to the request.
Once rules become active due to reinitialization, they are considered in future routing decissions.
Inactive rules may be reinitialized and, if reinitialization succeeds, become active.
By default, reinitialization is attempted at regular intervals using a timer (see setRetryInitInterval(int)).
Additionally, using the AdminConsoleInterceptor, an admin may trigger reinitialization of inactive rules at any time.
public URIFactory getUriFactory()
public void setUriFactory(URIFactory uriFactory)
public Statistics getStatistics()
public void setJmx(String name)
public String getJmx()
public void setBeanName(String s)
public String getId()
Copyright © 2021. All Rights Reserved.