Class ProcessDataContext
java.lang.Object
org.camunda.bpm.engine.impl.interceptor.ProcessDataContext
Holds the contextual process data.
New context properties are always part of a section that can be started by
A property can be pushed to the logging context (MDC) if there is a configured non-empty context name for it in the
New context properties are always part of a section that can be started by
pushSection(ExecutionEntity)
. The section keeps track of all pushed
properties. Those can easily be cleared by popping the section with
popSection()
afterwards, e.g. after the successful execution.A property can be pushed to the logging context (MDC) if there is a configured non-empty context name for it in the
process engine configuration
. The following configuration options are
available:
- loggingContextActivityId - the context property for the activity id
- loggingContextApplicationName - the context property for the application name
- loggingContextBusinessKey - the context property for the business key
- loggingContextDefinitionId - the context property for the definition id
- loggingContextProcessInstanceId - the context property for the instance id
- loggingContextTenantId - the context property for the tenant id
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected ProcessDataContext.ProcessDataStack
protected boolean
protected Map<String,
ProcessDataContext.ProcessDataStack> All data stacks we need to keep for MDC loggingprotected String
protected String
protected String
protected String
protected String
protected String
protected String
protected String
protected String
protected static final String
protected ProcessDataContext.ProcessDataSections
-
Constructor Summary
ConstructorDescriptionProcessDataContext
(ProcessEngineConfigurationImpl configuration) ProcessDataContext
(ProcessEngineConfigurationImpl configuration, boolean initFromCurrentMdc) ProcessDataContext
(ProcessEngineConfigurationImpl configuration, boolean initFromCurrentMdc, boolean parkExternalProperties) All-args constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToStack
(String value, String property) protected void
addToStack
(ProcessDataContext.ProcessDataStack stack, String value) void
clearMdc()
Remove all logging context properties from the MDCprotected boolean
protected String
initProperty
(Supplier<String> configSupplier) protected static boolean
isNotBlank
(String property) protected static boolean
protected String
parkExternalMDCProperty
(Supplier<String> configSupplier) protected void
parkExternalProperties
(ProcessEngineConfigurationImpl configuration) void
Pop the latest section, remove all pushed properties of that section and - if logging context properties are defined - update the MDC accordingly.boolean
pushSection
(ExecutionEntity execution) Start a new section that keeps track of the pushed properties.void
Restores the external properties to the MDC.void
Update the MDC with the current values of this logging contextprotected static boolean
valuesEqual
(String val1, String val2)
-
Field Details
-
NULL_VALUE
- See Also:
-
mdcPropertyActivityId
-
mdcPropertyActivityName
-
mdcPropertyApplicationName
-
mdcPropertyBusinessKey
-
mdcPropertyDefinitionId
-
mdcPropertyDefinitionKey
-
mdcPropertyInstanceId
-
mdcPropertyTenantId
-
mdcPropertyEngineName
-
handleMdc
protected boolean handleMdc -
activityIdStack
-
mdcDataStacks
All data stacks we need to keep for MDC logging -
sections
-
externalProperties
-
-
Constructor Details
-
ProcessDataContext
-
ProcessDataContext
-
ProcessDataContext
public ProcessDataContext(ProcessEngineConfigurationImpl configuration, boolean initFromCurrentMdc, boolean parkExternalProperties) All-args constructor.- Parameters:
configuration
- the process engine configuration to use to fetch Logging Context Parameters.initFromCurrentMdc
- when true, this process data context will be populated from the current state of the MDCparkExternalProperties
- when true, the MDC tuples that are the same as the configured logging context parameters will be preserved separately in the process data context.
-
-
Method Details
-
parkExternalProperties
-
initProperty
-
parkExternalMDCProperty
-
pushSection
Start a new section that keeps track of the pushed properties. If logging context properties are defined, the MDC is updated as well. This also includes clearing the MDC for the first section that is pushed for the logging context so that only the current properties will be present in the MDC (might be less than previously present in the MDC). The previous logging context needs to be reset in the MDC when this one is closed. This can be achieved by using#updateMdc(String)
with the previous logging context.- Parameters:
execution
- the execution to retrieve the context data from- Returns:
true
if the section contains any updates and therefore should be popped later bypopSection()
-
hasNoMdcValues
protected boolean hasNoMdcValues() -
popSection
public void popSection()Pop the latest section, remove all pushed properties of that section and - if logging context properties are defined - update the MDC accordingly. -
clearMdc
public void clearMdc()Remove all logging context properties from the MDC -
restoreExternalMDCProperties
public void restoreExternalMDCProperties()Restores the external properties to the MDC. Meant to be called for ProcessDataContexts associated with outer commands. -
updateMdcFromCurrentValues
public void updateMdcFromCurrentValues()Update the MDC with the current values of this logging context -
getLatestActivityId
- Returns:
- the latest value of the activity id property if exists,
null
otherwise
-
addToStack
-
addToStack
-
isNotBlank
-
valuesEqual
-
isNull
-