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 |
getCommandKey(Class<?> commandClass,
String tenantId,
String userName)
Constructs a command key for the given tenant identifier and user name, independent of whether they are
null or not. |
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 |
getTenantAndUserIsolatedKey(Class<?> commandClass)
Returns a tenant- and user-isolated command key.
|
static String |
getTenantIsolatedKey(Class<?> commandClass)
Returns a tenant-isolated command key.
|
public static String getDelimiter()
public static String getCommandKey(Class<?> commandClass, @Nullable String tenantId, @Nullable String userName)
null
or not. This provides the highest flexibility for defining different levels of isolation.commandClass
- Class of the command.tenantId
- The identifier of the tenant. If null
, there is not tenant isolation.userName
- The name of the user. If null
, there is no user isolation.public static String getGlobalKey(Class<?> commandClass)
commandClass
- The class of the command for which the key should be created.public static String getTenantAndUserIsolatedKey(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 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 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.