public class JdbcMessageReceiver extends TransactedPollingMessageReceiver
TransactedPollingMessageReceiver
reading data from a database.
Provides a way to acknowledge each read data using a SQL statement.TransactedPollingMessageReceiver.MessageProcessorWorker
Modifier and Type | Field and Description |
---|---|
protected List<String> |
ackParams |
protected String |
ackStmt |
protected JdbcConnector |
connector |
protected List<String> |
readParams |
protected String |
readStmt |
static String |
RECEIVE_MESSAGE_IN_TRANSCTION |
static String |
RECEIVE_MESSAGES_IN_XA_TRANSCTION |
boolean |
receiveMessagesInXaTransaction |
DEFAULT_POLL_FREQUENCY, DEFAULT_POLL_TIMEUNIT, DEFAULT_STARTUP_DELAY, schedules
defaultInboundTransformers, defaultResponseTransformers, flowConstruct, listener, receiverKey, replyToHandler
connected, defaultMessageInfoMapping, endpoint, lifecycleManager, logger, muleMessageFactory, retryTemplate
PHASE_NAME
PHASE_NAME
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
JdbcMessageReceiver(Connector connector,
FlowConstruct flowConstruct,
InboundEndpoint endpoint,
String readStmt,
String ackStmt) |
Modifier and Type | Method and Description |
---|---|
protected List<MuleMessage> |
createMuleMessages(List<Object> records)
Creates a mule message per each data record.
|
protected void |
doConnect() |
protected void |
doDisconnect() |
protected void |
doDispose() |
protected int |
executeAckStatement(Connection con,
MuleMessage muleMessage)
Executes the acknowledge SQL statement for a given message.
|
protected int[] |
executeBatchAckStatement(Connection con,
List<MuleMessage> messages)
Executes the acknowledge SQL statement for a list of messages.
|
protected List |
executeReadStatement(Connection con)
Executes the read SQL statement to get data from the database.
|
List |
getMessages() |
protected boolean |
hasAckStatement() |
protected void |
parseStatements(String readStmt,
String ackStmt)
Parses the read and acknowledge SQL statements
|
MuleEvent |
processMessage(Object message) |
doStart, hasNoMessages, isReceiveMessagesInTransaction, isUseMultipleTransactedReceivers, poll, setReceiveMessagesInTransaction, setUseMultipleTransactedReceivers
createWork, disableNativeScheduling, doStop, getBatchSize, getFrequency, getTimeUnit, performPoll, pollOnPrimaryInstanceOnly, schedule, setFrequency, setTimeUnit, unschedule
applyInboundTransformers, applyResponseTransformers, connectHandler, createExecutionTemplate, createLifecycleManager, createMuleEvent, doStartHandler, getConnectEventId, getConnectionDescription, getEndpoint, getEndpointURI, getFlowConstruct, getReceiverKey, getReplyToHandler, getWorkManager, handleUnacceptedFilter, initialise, processMessage, propagateRootMessageIdProperty, routeEvent, routeMessage, routeMessage, routeMessage, routeMessage, routeMessage, setEndpoint, setListener, setReceiverKey, shouldConsumeInEveryNode, toString, warnIfMuleClientSendUsed
activate, connect, createMuleMessage, createMuleMessage, createMuleMessage, createMuleMessageFactory, createNullMuleMessage, disconnect, dispose, disposeAndLogException, doInitialise, getConnectEventId, getConnector, getLifecycleState, initializeMessageFactory, initializeRetryPolicy, isConnected, isDoThreading, isStarted, isStarting, isStopped, isStopping, passivate, setEndpoint, start, stop, validate, validateConnection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createMuleMessage, createMuleMessage
connect, disconnect, isConnected, validateConnection
dispose
public static final String RECEIVE_MESSAGE_IN_TRANSCTION
public static final String RECEIVE_MESSAGES_IN_XA_TRANSCTION
protected JdbcConnector connector
protected String readStmt
protected String ackStmt
public boolean receiveMessagesInXaTransaction
public JdbcMessageReceiver(Connector connector, FlowConstruct flowConstruct, InboundEndpoint endpoint, String readStmt, String ackStmt) throws CreateException
CreateException
protected void parseStatements(String readStmt, String ackStmt)
protected void doDispose()
doDispose
in class AbstractMessageReceiver
protected void doConnect() throws Exception
doConnect
in class AbstractTransportMessageHandler
Exception
protected void doDisconnect() throws Exception
doDisconnect
in class AbstractTransportMessageHandler
Exception
public MuleEvent processMessage(Object message) throws Exception
processMessage
in class TransactedPollingMessageReceiver
Exception
protected boolean hasAckStatement()
protected List<MuleMessage> createMuleMessages(List<Object> records)
records
- data records used to created the payload of the new messages.protected int executeAckStatement(Connection con, MuleMessage muleMessage) throws Exception
con
- database connection to execute the statementmuleMessage
- message to been acknowledgeException
protected int[] executeBatchAckStatement(Connection con, List<MuleMessage> messages) throws Exception
con
- database connection to execute the statementmessages
- messages to be acknowledgeException
public List getMessages() throws Exception
getMessages
in class TransactedPollingMessageReceiver
Exception
protected List executeReadStatement(Connection con) throws Exception
con
- database connection to execute the statementException
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.