24 #include "StringUtil.h"
25 #include "BatchManager/BatchManager.h"
30 #define ROUTINGJOB_MAX_BACKOUT 3
66 RoutingJob(
const string& table,
const string& jobId,
const string&
function,
const int userId );
75 void setFunction(
const string&
function );
78 void setParallel(
const bool value =
true ) { m_IsParallel = value; }
82 bool isBatch()
const {
return m_IsBatch; }
84 void setBatchId(
const string& batchId,
const BatchManagerBase::BATCH_STATUS batchStatus )
88 m_BatchStatus = batchStatus;
92 void setBatchType(
const string& batchType )
94 m_BatchType = batchType;
97 BatchManagerBase::BATCH_STATUS
getBatchStatus()
const {
return m_BatchStatus; }
100 void setJobTable(
const string& table ) { m_RoutingPoint = table; }
104 void ReadNextJob(
const string& jobId );
112 catch(
const std::exception& ex )
114 TRACE(
"Unable to commit job [" << ex.what() <<
"]" );
118 TRACE(
"Unable to commit job." );
122 void Rollback()
const
128 catch(
const std::exception& ex )
130 TRACE(
"Unable to rollback job [" << ex.what() <<
"]" );
134 TRACE(
"Unable to rollback job." );
144 catch(
const std::exception& ex )
146 TRACE(
"Unable to abort job [" << ex.what() <<
"]" );
150 TRACE(
"Unable to abort job." );
154 BatchManagerBase::BATCH_STATUS Batch(
const string& batchId,
const string& correlId,
const string& feedback,
const string& xformItem,
const string& amountBDP,
const string& amountADP )
156 BatchManagerBase::BATCH_STATUS batchStatus = BatchManagerBase::BATCH_FAILED;
161 batchStatus =
RoutingDbOp::BatchJob( m_JobId, getFunctionParam( PARAM_GROUPORDER ), batchId, correlId, feedback, xformItem, amountBDP, amountADP );
166 catch(
const std::exception& ex )
168 TRACE(
"Unable to batch job [" << ex.what() <<
"]" );
172 TRACE(
"Unable to batch job." );
178 void Defer(
const long queueId,
const bool dbCommit =
true );
182 bool isDefered()
const {
return ( m_DeferedQueue != 0 ); }
185 bool hasUnhold()
const;
190 bool hasFunctionParam(
const string& paramName );
191 string getFunctionParam(
const string& paramName );
193 void addAction(
const string& action )
195 m_RoutingActions.push_back( action );
198 const vector< string >& getActions()
const
200 return m_RoutingActions;
206 const vector< string >& redirectActions = job.
getActions();
207 for(
unsigned int i=0; i<redirectActions.size(); i++ )
209 m_RoutingActions.push_back( redirectActions[ i ] );
214 void populateAddInfo( AppException& ex )
const;
217 void setDestination(
const string& destination ) { m_Destination = destination; }