public final class HystrixUtil extends Object
Setter
object that can be used to initialize Hystrix
Command
objects.
Therefore this class also handles the creation of command keys based on user and tenant Ids.
Constructor and Description |
---|
HystrixUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
getBestEffortIsolatedKey(Class<?> commandClass)
Returns a command key with the highest possible (best effort) level of user and tenant isolation.
|
static com.netflix.hystrix.HystrixCommandProperties.Setter |
getDefaultErpCommandProperties()
Getter for default command properties to be used by a Hystrix
Command . |
static com.netflix.hystrix.HystrixCommand.Setter |
getDefaultErpCommandSetter(Class<?> type)
Pre-initializes a Hystrix
Setter to be used to instantiate a Command . |
static com.netflix.hystrix.HystrixCommand.Setter |
getDefaultErpCommandSetter(Class<?> commandClass,
com.netflix.hystrix.HystrixCommandProperties.Setter commandProperties)
Pre-initializes a Hystrix
Setter to be used to instantiate a Command . |
static String |
getDelimiter()
The delimiter to be used between each component of the key.
|
static String |
getGlobalKey(Class<?> commandClass)
Returns a global command key without any isolation.
|
static String |
getTenantIsolatedKey(Class<?> commandClass)
Returns a tenant-isolated command key.
|
static String |
getTenantIsolatedOrGlobalKey(Class<?> commandClass)
Returns a tenant-isolated command key.
|
static String |
getUserIsolatedKey(Class<?> commandClass)
Returns a tenant- and user-isolated command key.
|
static String |
getUserOrTenantIsolatedKey(Class<?> commandClass)
Returns a tenant- and user-isolated command key.
|
public static String getDelimiter()
public static String getGlobalKey(Class<?> commandClass)
commandClass
- The class of the command for which the key should be created.public static String getTenantIsolatedKey(Class<?> commandClass) throws TenantNotAvailableException
commandClass
- The class of the command for which the key should be created.TenantNotAvailableException
- If there is currently no Tenant available. This typically occurs when trying to access the tenant
within code that is running outside any tenant context, e.g., within a background task.public static String getUserIsolatedKey(Class<?> commandClass) throws UserNotAuthenticatedException
commandClass
- The class of the command for which the key should be created.UserNotAuthenticatedException
- If the current User is not authenticated.public static String getUserOrTenantIsolatedKey(Class<?> commandClass) throws TenantNotAvailableException
commandClass
- The class of the command for which the key should be created.TenantNotAvailableException
- If there is currently no Tenant available. This typically occurs when trying to access the tenant
within code that is running outside any tenant context, e.g., within a background task.public static String getTenantIsolatedOrGlobalKey(Class<?> commandClass)
commandClass
- The class of the command for which the key should be created.public static String getBestEffortIsolatedKey(Class<?> commandClass)
commandClass
- The class of the command for which the key should be created.public static com.netflix.hystrix.HystrixCommand.Setter getDefaultErpCommandSetter(Class<?> type)
Setter
to be used to instantiate a Command
.type
- The class of the command to prepare the setter for.Setter
ready to initialize a Command
.public static com.netflix.hystrix.HystrixCommand.Setter getDefaultErpCommandSetter(Class<?> commandClass, com.netflix.hystrix.HystrixCommandProperties.Setter commandProperties)
Setter
to be used to instantiate a Command
.commandClass
- The class of the command to prepare the setter for.commandProperties
- Default properties for the command to execute.Setter
ready to initialize a Command
.public static com.netflix.hystrix.HystrixCommandProperties.Setter getDefaultErpCommandProperties()
Command
.HystrixCommandProperties.Setter
.Copyright © 2018 SAP SE. All rights reserved.