@NoImplement public interface SourceCallbackContext
Source
to
a particular stateModifier and Type | Method and Description |
---|---|
void |
addVariable(String variableName,
Object value)
Adds a variable
|
TransactionHandle |
bindConnection(Object connection)
Associates the given
connection to this context. |
void |
fireOnHandle(NotificationActionDefinition<?> action,
TypedValue<?> data)
Indicates that an
ExtensionNotification should be fired with the desired information when the runtime takes the
source result to process it. |
<T> T |
getConnection()
Returns the connection that was bound through
bindConnection(Object) . |
Optional<String> |
getCorrelationId() |
<T,A> SourceCallback<T,A> |
getSourceCallback() |
TransactionHandle |
getTransactionHandle()
A handle to the current on-going transaction.
|
<T> Optional<T> |
getVariable(String variableName)
Returns the value associated to a variable of name
variableName |
boolean |
hasVariable(String variableName)
Returns whether a variable of name
variableName has a value associated to it
through the addVariable(String, Object) method |
void |
setCorrelationId(String correlationId)
Sets the correlationId of the event that will be passed to the flow when the
SourceCallback.handle(Result, SourceCallbackContext) method is invoked. |
TransactionHandle bindConnection(Object connection) throws ConnectionException, TransactionException
connection
to this
context. As a result of this binding,
the runtime will automatically take care of releasing the connection
once the source has
finished processing the response and will also take care of resolving the associated transaction (if any).
If the connection is a TransactionalConnection
and the source was configured to be transactional,
then this method will start such transaction.
connection
- the connection to be boundTransactionHandle
produced as a result of the bindingConnectionException
- if the connection is not valid or cannot be usedTransactionException
- if a transaction was needed but couldn't be started.<T> T getConnection() throws IllegalStateException
bindConnection(Object)
.
If that method was not called, then it will throw IllegalStateException
T
- the generic type of the connectionIllegalStateException
- if no connection boundTransactionHandle getTransactionHandle()
This method can be used without the need for bindConnection(Object)
to had been invoked on this
instance
first. However if it has, then the result of this method will be the exact same instance that
bindConnection(Object)
returned.
TransactionHandle
boolean hasVariable(String variableName)
variableName
has a value associated to it
through the addVariable(String, Object)
methodvariableName
- the name of a variable associated to a particular SourceCallback
true
if the parameter is present.<T> Optional<T> getVariable(String variableName)
variableName
T
- the returned value's generic typevariableName
- the name of a variable of a SourceCallback
Optional
of the variable's value.void addVariable(String variableName, Object value)
variableName
- the name of the variablevalue
- the variable's valuevoid setCorrelationId(String correlationId)
SourceCallback.handle(Result, SourceCallbackContext)
method is invoked.
This method can only be invoked BEFORE this
instance has been used on a
SourceCallback.handle(Result, SourceCallbackContext)
operation. Otherwise, an
IllegalStateException
will be thrown.
correlationId
- a correlationIdIllegalArgumentException
- if invoked once this
context has already been used to push a messageOptional<String> getCorrelationId()
setCorrelationId(String)
(if any).<T,A> SourceCallback<T,A> getSourceCallback()
T
- the generic type of the output values of the generated resultsA
- the generic type of the attributes of the generated resultsSourceCallback
that generated this
contextvoid fireOnHandle(NotificationActionDefinition<?> action, TypedValue<?> data)
ExtensionNotification
should be fired with the desired information when the runtime takes the
source result to process it.action
- the NotificationActionDefinition
to use.data
- the TypedValue
data to use.Copyright © 2018. All rights reserved.