Class LambdaRouterMiddleware
- java.lang.Object
-
- com.networknt.aws.lambda.handler.middleware.router.LambdaRouterMiddleware
-
- All Implemented Interfaces:
LambdaHandler,MiddlewareHandler
public class LambdaRouterMiddleware extends Object implements MiddlewareHandler
This middleware is responsible for routing the incoming request to the external microservices.
-
-
Field Summary
Fields Modifier and Type Field Description static com.networknt.router.RouterConfigCONFIGstatic StringEXCHANGE_HAS_FAILED_STATEstatic StringFAILED_TO_INVOKE_SERVICE-
Fields inherited from interface com.networknt.aws.lambda.handler.LambdaHandler
DISABLED_LAMBDA_HANDLER_RETURN, SUCCESS_LAMBDA_HANDLER_RETURN
-
-
Constructor Summary
Constructors Constructor Description LambdaRouterMiddleware()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateRouterRequestPath(List<com.networknt.handler.config.UrlRewriteRule> urlRewriteRules, String requestPath)Builds a complete request path string for our router request.com.networknt.status.Statusexecute(LightLambdaExchange exchange)voidgetCachedConfigurations()booleanisAsynchronous()Indicate if this middleware handler is asynchronous or not.booleanisAudited()Indicate if this middleware handler is audited or not.booleanisContinueOnFailure()Indicate if this middleware handler will continue on failure or not.booleanisEnabled()Indicate if this handler is enabled or not.voidregister()Register this handler to the handler registration.voidreload()Reload config values in case the config values changed by config server.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.networknt.aws.lambda.handler.LambdaHandler
disabledMiddlewareStatus, isResponseMiddleware, successMiddlewareStatus
-
-
-
-
Field Detail
-
FAILED_TO_INVOKE_SERVICE
public static final String FAILED_TO_INVOKE_SERVICE
- See Also:
- Constant Field Values
-
EXCHANGE_HAS_FAILED_STATE
public static final String EXCHANGE_HAS_FAILED_STATE
- See Also:
- Constant Field Values
-
CONFIG
public static final com.networknt.router.RouterConfig CONFIG
-
-
Method Detail
-
execute
public com.networknt.status.Status execute(LightLambdaExchange exchange)
- Specified by:
executein interfaceLambdaHandler
-
createRouterRequestPath
public String createRouterRequestPath(List<com.networknt.handler.config.UrlRewriteRule> urlRewriteRules, String requestPath)
Builds a complete request path string for our router request.- Parameters:
urlRewriteRules- - the list of url rewrite rulesrequestPath- - the original request path- Returns:
- - targetRequestPath the target request path string
-
isEnabled
public boolean isEnabled()
Description copied from interface:LambdaHandlerIndicate if this handler is enabled or not.- Specified by:
isEnabledin interfaceLambdaHandler- Returns:
- boolean true if enabled
-
register
public void register()
Description copied from interface:LambdaHandlerRegister this handler to the handler registration.- Specified by:
registerin interfaceLambdaHandler
-
reload
public void reload()
Description copied from interface:LambdaHandlerReload config values in case the config values changed by config server.- Specified by:
reloadin interfaceLambdaHandler
-
isContinueOnFailure
public boolean isContinueOnFailure()
Description copied from interface:MiddlewareHandlerIndicate if this middleware handler will continue on failure or not.- Specified by:
isContinueOnFailurein interfaceMiddlewareHandler- Returns:
- boolean true if continue on failure
-
isAudited
public boolean isAudited()
Description copied from interface:MiddlewareHandlerIndicate if this middleware handler is audited or not.- Specified by:
isAuditedin interfaceMiddlewareHandler- Returns:
- boolean true if audited
-
isAsynchronous
public boolean isAsynchronous()
Description copied from interface:LambdaHandlerIndicate if this middleware handler is asynchronous or not.- Specified by:
isAsynchronousin interfaceLambdaHandler- Returns:
- boolean true if asynchronous
-
getCachedConfigurations
public void getCachedConfigurations()
- Specified by:
getCachedConfigurationsin interfaceMiddlewareHandler
-
-