Operator ExceptionCatcher
DEPRECATED: The com.teracloud.streams.teda.ExceptionCatcher operator is deprecated and the @catch annotation should be used instead. The deprecated operator might be removed in a future release.
The ExceptionCatcher operator catches exceptions from fused downstream operators and reports these exceptions via tuples that are sent to its optional second output port. The corresponding processing element is able to continue processing tuples.
The operator forwards input tuples to its mandatory first output port.
The operator is useful if you want to prevent the processing element from failing when an exception is thrown from a downstream operator.
This operator requires that it is fused with all the guarded operators into one processing element and that it is the most upstream operator. The guarded operators must not generate their own threads. In other words, you cannot use threaded ports, ThreadedSplit, or UDP for the guarded operators because exceptions cannot be caught from these operators.
Behavior in a consistent region
- The ExceptionCatcher operator is not supported in a consistent region. A warning occurs when you compile your streams processing application.
- The operator cannot be the start of a consistent region. An error occurs when you compile your streams processing application.
Summary
- Ports
- This operator has 1 input port and 2 output ports.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator does not support parameters.
- Metrics
- This operator reports 1 metric.
Properties
- Implementation
- C++
- Threading
- Always - Operator always provides a single threaded execution context.
- Ports (0)
-
The port that ingests the tuples that will be forwarded.
- Properties
-
- Optional: false
- ControlPort: false
- TupleMutationAllowed: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
- Output Functions
-
- Functions
-
- <any T> T AsIs(T)
-
The original argument expression is submitted.
- public rstring getExceptionType()
-
Returns the type of the exception, which can be SPL, STD, or any other exception type.
- public rstring getExceptionText()
-
Returns the text of the caught exception.
- Ports (0)
-
The port that receives all tuples from the input port.
This operator requires that the stream type of this output port matches the stream type of the input port.
- Assignments
- This port set does not allow assignments to output attributes.
- Properties
-
- Optional: false
- TupleMutationAllowed: false
- WindowPunctuationOutputMode: Preserving
- Ports (1)
-
The output port that receives tuples from the input port that resulted in an exception.
The exception type and text can be assigned to the output attributes by using the getExceptionType() and getExceptionText() functions.
- Assignments
- This port set allows any SPL expression of the correct type to be assigned to output attributes. Attributes not assigned in the output clause will be automatically assigned from the attributes of the input ports that have the same name and type. If there is no such input attribute, an error is reported at compile-time.
- Properties
-
- Optional: true
- TupleMutationAllowed: true
- WindowPunctuationOutputMode: Free
- ExceptionCatcher
-
( stream<I> ${OutputStream}; stream<I, tuple<rstring exceptionType, rstring exceptionText>> ${ErrorStream} as E ) = ExceptionCatcher(${InputStream} as I) { output E: exceptionType = getExceptionType(), exceptionText = getExceptionText(); config placement: partitionColocation("${name}");${cursor} }
- nExceptions - Counter
-
The number of caught exceptions