@CamelConfiguration(value="msgRouteBean") public class AsynchMessageRoute extends AbstractBasicRoute
Some "well-known" URIs:
Modifier and Type | Field and Description |
---|---|
static String |
ROUTE_BEAN |
static String |
ROUTE_ID_ASYNC
The route that polls the message queue for processing a new message.
|
static String |
ROUTE_ID_ASYNCH_ERROR_HANDLING
Route for error handling.
|
static String |
ROUTE_ID_CONFIRM_MESSAGE
Route for ensuring the provided message status confirmation to the source system.
|
static String |
ROUTE_ID_ERROR_FATAL
Route for processing FATAL error.
|
static String |
ROUTE_ID_POST_PROCESS_AFTER_FAILED
Route for post-processing when FATAL error occurs.
|
static String |
ROUTE_ID_POST_PROCESS_AFTER_OK
Route for post-processing when FATAL error occurs.
|
static String |
ROUTE_ID_SYNC
The main route for processing message from the queue.
|
static String |
URI_ASYNC_PROCESSING_MSG
URI for asynchronous message processing (with SEDA).
|
static String |
URI_SYNC_MSG
URI for synchronous message processing.
|
EXTERNAL_ROUTE_SUFFIX, IN_ROUTE_SUFFIX, OUT_ROUTE_SUFFIX, ROUTE_ID_DELIMITER, ROUTE_SUFFIX
Constructor and Description |
---|
AsynchMessageRoute() |
Modifier and Type | Method and Description |
---|---|
void |
changeStateMessageToInQueue(Message msg)
Change state of message into
MsgStateEnum.IN_QUEUE . |
boolean |
checkMessageFailed(Message msg,
Exception ex)
Returns
true if failed count exceeds limit for failing. |
boolean |
checkParentMessage(Message msg) |
protected void |
doConfigure()
Route for processing
messages from the queue. |
void |
isAbleToHandleExistingMessage()
Checks if actual node handles existing message.
|
boolean |
isMessageObsolete(Message msg)
Checks if current message wasn't converted to other state.
|
void |
logStartProcessing(Message msg,
Long msgInsertTime) |
String |
nextRoute(Message msg)
Gets URI of the next route.
|
void |
sendMailToAdmin(Message msg)
Sends notification mail to admin(s).
|
void |
setEntityInfo(Message msg,
Map<String,Object> headers)
Sets
AsynchConstants.OBJECT_ID_HEADER and AsynchConstants.ENTITY_TYPE_HEADER
headers if there are available corresponding values in message. |
void |
setLogContextParams(Message message,
String requestId)
Set log context parameters.
|
addEventNotifier, configure, doErrorHandling, exceptionHandling, getBean, getExternalRouteId, getInRouteId, getInWsUri, getInWsUri, getOutRouteId, getOutWsSoap12Uri, getOutWsSoap12Uri, getOutWsUri, getOutWsUri, getRouteId, isAsynch, printMessageHistory, toString
getApplicationContext, lookup, lookup, setApplicationContext, transactionErrorHandler, transactionErrorHandler, transactionErrorHandler, transactionErrorHandler
addRoutes, addRoutesToCamelContext, checkInitialized, configureRest, configureRests, configureRoute, configureRoutes, createContainer, errorHandler, from, from, from, from, fromF, getContext, getRestCollection, getRestConfigurations, getRouteCollection, includeRoutes, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, onCompletion, onException, onException, populateRests, populateRoutes, rest, rest, restConfiguration, restConfiguration, setErrorHandlerBuilder, setRestCollection, setRouteCollection
bean, bean, bean, bean, body, body, bodyAs, constant, createErrorHandlerBuilder, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, endpoints, endpoints, exceptionMessage, exchangeProperty, faultBody, faultBodyAs, getErrorHandlerBuilder, header, language, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, loggingErrorHandler, method, method, method, method, noErrorHandler, outBody, outBody, property, regexReplaceAll, regexReplaceAll, sendTo, setContext, setContext, simple, simple, simpleF, simpleF, systemProperty, systemProperty, xpath, xpath
public static final String ROUTE_BEAN
public static final String ROUTE_ID_SYNC
public static final String ROUTE_ID_ASYNC
public static final String ROUTE_ID_ASYNCH_ERROR_HANDLING
public static final String ROUTE_ID_ERROR_FATAL
public static final String ROUTE_ID_POST_PROCESS_AFTER_FAILED
public static final String ROUTE_ID_POST_PROCESS_AFTER_OK
public static final String ROUTE_ID_CONFIRM_MESSAGE
public static final String URI_ASYNC_PROCESSING_MSG
public static final String URI_SYNC_MSG
protected void doConfigure() throws Exception
messages
from the queue.
Prerequisite: Message in the body in the state MsgStateEnum.PROCESSING
Output: correctly processed message
doConfigure
in class AbstractBasicRoute
Exception
- can be thrown during configuration@Handler public void setLogContextParams(@Body Message message, @Header(value="REQUEST_ID") @Nullable String requestId)
message
- the messagerequestId
- the request IDLogContextHelper.setLogContextParams(Message, String)
@Handler public boolean isMessageObsolete(@Body Message msg)
msg
- the messagetrue
when message is in wrong state false
otherwise@Handler public void logStartProcessing(@Body Message msg, @Nullable @Header(value="insertMsgToQueue") Long msgInsertTime)
@Handler public void setEntityInfo(@Body Message msg, @Headers Map<String,Object> headers)
AsynchConstants.OBJECT_ID_HEADER
and AsynchConstants.ENTITY_TYPE_HEADER
headers if there are available corresponding values in message.msg
- the messageheaders
- the headers@Handler public boolean checkMessageFailed(@Header(value="processingMessage") Message msg, @Nullable Exception ex)
true
if failed count exceeds limit for failing.msg
- the messageex
- error in processing Message
, NULL
- no errortrue
when limit was exceeded, otherwise false
@Handler public boolean checkParentMessage(@Header(value="processingMessage") Message msg)
@Handler public void sendMailToAdmin(@Header(value="processingMessage") Message msg)
msg
- as context of process@Handler public String nextRoute(@Header(value="processingMessage") Message msg)
AbstractBasicRoute.OUT_ROUTE_SUFFIX
"msg
- the message@Handler public void changeStateMessageToInQueue(@Body Message msg) throws LockFailureException
MsgStateEnum.IN_QUEUE
.msg
- message in which will be changed stateLockFailureException
- if change state into MsgStateEnum.IN_QUEUE
fails@Handler public void isAbleToHandleExistingMessage() throws StoppingException
StoppingException
- if node not handles existing messageCopyright © 2018 Pivotal Software, Inc.. All rights reserved.