Interface BacklogTracerEventMessage
- All Superinterfaces:
BacklogEventMessage
Snapshot of a single exchange event captured by the
BacklogTracer as a message transits a route node.
Each instance represents a detached, point-in-time view of the exchange at one route node: the exchange body and
headers are serialized to XML/JSON at capture time so they can be read after the exchange has moved on or has
completed. The unique getUid() counter and getTimestamp() allow events to be correlated and ordered
across concurrent exchanges.
For each route a message passes through, the tracer emits at least two events: a "first" event when the exchange
enters the route (isFirst()) and a "last" event when it leaves (isLast()). An exchange routed
across multiple routes (e.g. via Direct or SEDA) produces separate first/last pairs for each route.- Since:
- 4.0
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionasJSon()The event message as an org.apache.camel.util.json.JsonObject object.@Nullable StringThe breadcrumb id that links exchanges across broker boundaries (Kafka, SEDA, JMS, etc.)@Nullable StringThe correlation id to a parent exchange (if any)longTime elapsed for processing the given node (in millis).Optional endpoint metadata that is relevant to the service as key value pairs.@Nullable StringGet the endpoint protocol the service is using such as http, amqp, tcp.@Nullable StringGets the endpoint remote address such as URL, hostname, connection-string, or cloud region, that are component specific.@Nullable StringThe endpoint uri if this trace is either from a route input (from), or the exchange was sent to an endpoint such as (to, toD, wireTap) etc.@Nullable StringThe exception as JSon (exception type, message and stacktrace)@Nullable StringThe exception as XML (exception type, message and stacktrace)The exchange idThe original incoming route id@Nullable StringThe location of the trace (source code name:line) if possible.The content of the message as JSon (body and headers)The content of the message as XML (body and headers)The name of the thread that is processing the message, when this event was captured.Current route idlongTimestamp of the traced event@Nullable StringNode id where the message is being routed toNode label where the message is being routed tointNode processor level@Nullable StringParent node id for this node@Nullable StringSpecial for choice where we want to know which when predicate was triggered@Nullable StringSpecial for choice where we want to know which when predicate was triggeredNode short name where the message is being routed tolonggetUid()Unique id of the traced messagebooleanWas there an exception thrown during processingbooleanisDone()Whether the message is done processing the given nodebooleanisFailed()Did the message fail during processing (i.e. was an exception thrown)booleanisFirst()Whether this is first message for a given route When a message is routed via multiple routes, then each route will have a first/last pair.booleanisLast()Whether this is last message for a given route When a message is routed via multiple routes, then each route will have a first/last pair.booleanWhether the endpoint is remote.booleanisRest()Whether this event was from a route that is created from Rest DSL.booleanWhether the endpoint is a stub endpoint.booleanWhether this event was from a route that is created from route template or kamelet.voidsetException(Throwable cause) The tracing caused an exception which can be capturedtoJSon(int indent) Dumps the event message as JSon.toXml(int indent) Dumps the event message as XML using theROOT_TAGas root tag.
-
Field Details
-
ROOT_TAG
- See Also:
-
TIMESTAMP_FORMAT
- See Also:
-
-
Method Details
-
getUid
-
isFirst
boolean isFirst()Whether this is first message for a given route When a message is routed via multiple routes, then each route will have a first/last pair. -
isLast
boolean isLast()Whether this is last message for a given route When a message is routed via multiple routes, then each route will have a first/last pair. -
getTimestamp
long getTimestamp()Timestamp of the traced event- Specified by:
getTimestampin interfaceBacklogEventMessage
-
getLocation
@Nullable String getLocation()The location of the trace (source code name:line) if possible.- Specified by:
getLocationin interfaceBacklogEventMessage
-
getRouteId
-
getFromRouteId
String getFromRouteId()The original incoming route id- Specified by:
getFromRouteIdin interfaceBacklogEventMessage
-
isRest
boolean isRest()Whether this event was from a route that is created from Rest DSL. -
isTemplate
boolean isTemplate()Whether this event was from a route that is created from route template or kamelet. -
getToNode
@Nullable String getToNode()Node id where the message is being routed to- Specified by:
getToNodein interfaceBacklogEventMessage
-
getToNodeParentId
@Nullable String getToNodeParentId()Parent node id for this node -
getToNodeParentWhenId
@Nullable String getToNodeParentWhenId()Special for choice where we want to know which when predicate was triggered -
getToNodeParentWhenLabel
@Nullable String getToNodeParentWhenLabel()Special for choice where we want to know which when predicate was triggered -
getToNodeShortName
String getToNodeShortName()Node short name where the message is being routed to -
getToNodeLabel
String getToNodeLabel()Node label where the message is being routed to -
getToNodeLevel
int getToNodeLevel()Node processor level -
getExchangeId
-
getCorrelationExchangeId
@Nullable String getCorrelationExchangeId()The correlation id to a parent exchange (if any) -
getBreadcrumbId
@Nullable String getBreadcrumbId()The breadcrumb id that links exchanges across broker boundaries (Kafka, SEDA, JMS, etc.)- Since:
- 4.21
-
getProcessingThreadName
String getProcessingThreadName()The name of the thread that is processing the message, when this event was captured.- Specified by:
getProcessingThreadNamein interfaceBacklogEventMessage
-
getMessageAsXml
String getMessageAsXml()The content of the message as XML (body and headers) -
getMessageAsJSon
String getMessageAsJSon()The content of the message as JSon (body and headers)- Specified by:
getMessageAsJSonin interfaceBacklogEventMessage
-
getElapsed
long getElapsed()Time elapsed for processing the given node (in millis). -
isDone
boolean isDone()Whether the message is done processing the given node -
isFailed
boolean isFailed()Did the message fail during processing (i.e. was an exception thrown) -
hasException
boolean hasException()Was there an exception thrown during processing- Specified by:
hasExceptionin interfaceBacklogEventMessage
-
setException
The tracing caused an exception which can be captured -
getExceptionAsXml
@Nullable String getExceptionAsXml()The exception as XML (exception type, message and stacktrace) -
getExceptionAsJSon
@Nullable String getExceptionAsJSon()The exception as JSon (exception type, message and stacktrace)- Specified by:
getExceptionAsJSonin interfaceBacklogEventMessage
-
getEndpointUri
@Nullable String getEndpointUri()The endpoint uri if this trace is either from a route input (from), or the exchange was sent to an endpoint such as (to, toD, wireTap) etc.- Specified by:
getEndpointUriin interfaceBacklogEventMessage
-
isRemoteEndpoint
boolean isRemoteEndpoint()Whether the endpoint is remote.- See Also:
-
isStubEndpoint
boolean isStubEndpoint()Whether the endpoint is a stub endpoint.- Since:
- 4.21
-
getEndpointServiceUrl
@Nullable String getEndpointServiceUrl()Gets the endpoint remote address such as URL, hostname, connection-string, or cloud region, that are component specific.- Returns:
- the address or null if no address can be determined.
- See Also:
-
getEndpointServiceProtocol
@Nullable String getEndpointServiceProtocol()Get the endpoint protocol the service is using such as http, amqp, tcp.- See Also:
-
getEndpointServiceMetadata
Optional endpoint metadata that is relevant to the service as key value pairs. Notice that the metadata is not supposed to contain sensitive security details such as access token, api keys, or passwords. Only share information that can be safely accessed and written to logs.- Returns:
- optional metadata or null if no data
- See Also:
-
toXml
Dumps the event message as XML using theROOT_TAGas root tag. The timestamp tag is formatted in the format defined byTIMESTAMP_FORMAT- Parameters:
indent- number of spaces to indent- Returns:
- xml representation of this event
-
toJSon
Dumps the event message as JSon.- Specified by:
toJSonin interfaceBacklogEventMessage- Parameters:
indent- number of spaces to indent- Returns:
- JSon representation of this event
-
asJSon
The event message as an org.apache.camel.util.json.JsonObject object.- Specified by:
asJSonin interfaceBacklogEventMessage
-