Package org.frankframework.core
Class PipeLineSession
- All Implemented Interfaces:
Serializable,AutoCloseable,Cloneable,Map<String,Object>
Basic implementation of
PipeLineSession.- Since:
- version 3.2.2
- Author:
- Johan Verrips IOS
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionCreate new PipeLineSession from existing map or session. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanRetrieves abooleanvalue from the PipeLineSessiondoubleRetrieves adoublevalue from the PipeLineSessionintRetrieves anintvalue from the PipeLineSessionlongRetrieves alongvalue from the PipeLineSessionRetrieves aStringvalue from the PipeLineSessiongetBoolean(String key) Retrieves aBooleanvalue from the PipeLineSessiongetInteger(String key) Retrieves anIntegervalue from the PipeLineSessiongetMessage(String key) Retrieves the value associated with the specified key and returns it as aMessageobject.Get value of a PipeLineSession key as String.static InstantgetTsReceived(Map<String, Object> context) static InstantvoidmergeToParentSession(String keysToCopy, PipeLineSession parentSession) voidvoidscheduleCloseOnSessionExit(AutoCloseable resource) voidsetExitState(PipeLine.ExitState state, Integer code) voidsetExitState(PipeLineResult pipeLineResult) voidsetSecurityHandler(ISecurityHandler handler) voidunscheduleCloseOnSessionExit(AutoCloseable resource) static voidConvenience method to set required parameters from listeners.static voidupdateListenerParameters(Map<String, Object> map, String messageId, String correlationId, Instant tsReceived, Instant tsSent) Convenience method to set required parameters from listeners.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
SYSTEM_MANAGED_RESOURCE_PREFIX
- See Also:
-
ORIGINAL_MESSAGE_KEY
- See Also:
-
MESSAGE_ID_KEY
- See Also:
-
CORRELATION_ID_KEY
- See Also:
-
STORAGE_ID_KEY
- See Also:
-
TS_RECEIVED_KEY
- See Also:
-
TS_SENT_KEY
- See Also:
-
SECURITY_HANDLER_KEY
- See Also:
-
MANUAL_RETRY_KEY
- See Also:
-
HTTP_REQUEST_KEY
- See Also:
-
HTTP_RESPONSE_KEY
- See Also:
-
HTTP_METHOD_KEY
- See Also:
-
API_PRINCIPAL_KEY
- See Also:
-
EXIT_STATE_CONTEXT_KEY
- See Also:
-
EXIT_CODE_CONTEXT_KEY
- See Also:
-
-
Constructor Details
-
PipeLineSession
public PipeLineSession() -
PipeLineSession
Create new PipeLineSession from existing map or session. This may not be null!- Parameters:
t-Mapor PipeLineSession from which to copy session variables into the new session. Should not be null!
-
-
Method Details
-
setExitState
-
setExitState
-
mergeToParentSession
Copy specified keys from thefromPipeLineSessionto the parentPipeLineSessionorMapto. Any keys present in both parent and child session will be unregistered from closing on the closing of the child session.The keys which will be copied are specified in parameter
keysToCopy. Keys names are separated by , or ; symbols. If that parameter isnullthen all keys will be copied, if it is an empty string then no keys will be copied.- Parameters:
keysToCopy- Keys to be copied, separated by , or ;. Ifnullthen all keys will be copied. If an empty string then no keys will be copied.parentSession- ParentPipeLineSession.
-
put
-
putAll
-
getMessageId
-
getCorrelationId
-
getMessage
Retrieves the value associated with the specified key and returns it as aMessageobject. If the key does not exist or the value is null, it returns a null message.NB: If the underlying value was a stream, reading the message will read the underlying stream. The value can be preserved in the message, but the underlying stream can not be preserved and reading the same session key again will effectively return an empty value.
- Parameters:
key- The key for which to retrieve the value.- Returns:
- The value associated with the key encapsulated in a
Messageobject. If the key does not exist or the value is null, a null message is returned.
-
getTsReceived
-
getTsReceived
-
getTsSent
-
getTsSent
-
updateListenerParameters
public static void updateListenerParameters(@Nonnull Map<String, Object> map, @Nullable String messageId, @Nullable String correlationId) Convenience method to set required parameters from listeners. Will not update messageId and correlationId when NULL. Sets the current date-time as TS-Received. -
updateListenerParameters
public static void updateListenerParameters(@Nonnull Map<String, Object> map, @Nullable String messageId, @Nullable String correlationId, @Nullable Instant tsReceived, @Nullable Instant tsSent) Convenience method to set required parameters from listeners. Will not update messageId and correlationId when NULL. Will use current date-time for TS-Received if null. -
setSecurityHandler
-
getSecurityHandler
@Nonnull public ISecurityHandler getSecurityHandler() throws org.apache.commons.lang3.NotImplementedException- Throws:
org.apache.commons.lang3.NotImplementedException
-
getString
Get value of a PipeLineSession key as String.NB: If the value was a stream, the stream is read and closed. If the value was another kind of
AutoCloseable, then a side effect of this method may also be the value was closed.- Parameters:
key- Session key to get.- Returns:
- Value of the session key as String, or NULL of either the key was not present or had a NULL value.
-
get
Retrieves aStringvalue from the PipeLineSession- Parameters:
key- the referenced keydefaultValue- the value to return when the key cannot be found- Returns:
- String
-
get
Retrieves abooleanvalue from the PipeLineSession- Parameters:
key- the referenced keydefaultValue- the value to return when the key cannot be found- Returns:
- boolean
-
getBoolean
Retrieves aBooleanvalue from the PipeLineSession- Parameters:
key- the referenced key- Returns:
- Boolean
-
get
Retrieves anintvalue from the PipeLineSession- Parameters:
key- the referenced keydefaultValue- the value to return when the key cannot be found- Returns:
- int
-
getInteger
Retrieves anIntegervalue from the PipeLineSession- Parameters:
key- the referenced key- Returns:
- Integer
-
get
Retrieves alongvalue from the PipeLineSession- Parameters:
key- the referenced keydefaultValue- the value to return when the key cannot be found- Returns:
- long
-
get
Retrieves adoublevalue from the PipeLineSession- Parameters:
key- the referenced keydefaultValue- the value to return when the key cannot be found- Returns:
- double
-
scheduleCloseOnSessionExit
-
unscheduleCloseOnSessionExit
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-