1. Proxies and Flow

router

Version

Membrane API Gateway'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.

Syntax

<router
exchangeStore="string"
hotDeploy="[true,false]"
adjustHostHeader="[true,false]"
indentMessage="[true,false]"
adjustContentLength="[true,false]"
trackExchange="[true,false]" />
<router
	exchangeStore="string"
	hotDeploy="[true,false]"
	adjustHostHeader="[true,false]"
	indentMessage="[true,false]"
	adjustContentLength="[true,false]"
	trackExchange="[true,false]" />

Sample

<beans>
<router
exchangeStore="memoryExchangeStore"
adjustHostHeader="true"
indentMessage="true"
adjustContentLength="true" />

</beans>
<beans>
<router
  exchangeStore="memoryExchangeStore"
  adjustHostHeader="true"
  indentMessage="true"
  adjustContentLength="true" />
</beans>

Attributes

NameRequiredDefaultDescriptionExamples
exchangeStorefalsecreate a {@link LimitedMemoryExchangeStore} limited to the size of 1 MB.Spring Bean ID of an {@link ExchangeStore}. The exchange store will be used by this router's components ({@link AdminConsoleInterceptor}, {@link ExchangeStoreInterceptor}, etc.) by default, if no other exchange store is explicitly set to be used by them.-
hotDeployfalsetrue

Whether changes to the router's configuration file should automatically trigger a restart.

Monitoring the router's configuration file proxies.xml is only possible, if the router is created by a Spring Application Context which supports monitoring.

-
jmxfalse-Sets the JMX name for this router. Also declare a global <jmxExporter> instance.-
productionfalsefalseExplanation:

By default the error messages Membrane sends back to an HTTP client provide information to help the caller find the problem. The caller might even get sensitive information. In production the error messages should not reveal to much details. With this option you can put Membrane in production mode and reduce the amount of information in error messages.


-
retryInitfalsefalseExplanation:

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 {@link Proxy#isActive()}).

Inactive rules

Inactive rules will simply be ignored for routing decisions 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 decision.

Reinitialization

Inactive rules may be reinitialized and, if reinitialization succeeds, become active.

By default, reinitialization is attempted at regular intervals using a timer (see {@link #setRetryInitInterval(int)}).

Additionally, using the {@link AdminConsoleInterceptor}, an admin may trigger reinitialization of inactive rules at any time.


-
retryInitIntervalfalse5 minutesnumber of milliseconds after which reinitialization of <soapProxy>s should be attempted periodically-

Child Elements

ElementDescriptionCardinality
apiThe api proxy extends the serviceProxy with API related functions like OpenAPI support and path parameters.0..*
globalThe global chain applies plugins to all endpoints, enabling centralized features such as global user authentication, logging, and other cross-cutting concerns.0..1
httpClientConfigConfiguration container for Membrane's HTTP client. Allows defining proxy, connection, authentication, TLS, and retry behavior. Can be used as a reusable bean and referenced via . Most of its sub-elements are optional.0..1
internalInternal proxy that can only be invoked by other proxies within the gateway. An internal proxy does not listen on any port.0..*
proxyClients can send HTTP requests to a proxy that forward the request to a Web server. It acts on behalf of the client.0..*
serviceProxyA service proxy can be deployed on front of a Web server, Web Service or a REST resource. It conceals the server and offers the same interface as the target server to its clients.0..*
soapProxyA SOAP proxy automatically configures itself using a WSDL description. It reads the WSDL to extract:0..*
sslProxy0..*
stompProxyProxies incoming STOMP CONNECT requests. Use a <stompClient> to forward these requests so some other machine.0..*
transportThe transport receives messages from clients and invokes interceptors in the request and response flow. The interceptors that are engaged with the transport are global and are invoked for each message flowing through the router.0..1

Can be used in