Quintiq file version 2.0
|
#parent: #root
|
Method ExecuteFirstInboundMessage (
|
DSP_ServiceCommitterBase local_committer
|
) as Boolean
|
{
|
Description:
|
[*
|
Executes a single inbound message and returns true if this was succesful
|
When not succesfull kick error processing.
|
*]
|
TextBody:
|
[*
|
soft_error := "";
|
can_continue := false;
|
dsp := this.DistributedServiceProviderBase();
|
imsg := this.InboundMessageQueue().FirstMessage();
|
is_full_sync_msg := imsg.istype( DSP_FullSyncMessage );
|
|
if ( imsg.StateSeqNr() >=0 and local_committer.StateSeqNr() > imsg.StateSeqNr() )
|
{
|
dsp.Log( "Skipping message " + [String]imsg.StateSeqNr() + " while in state " + [String] local_committer.StateSeqNr(), false );
|
imsg.Delete();
|
can_continue := true;
|
}
|
else if ( imsg.StateSeqNr() >= 0 and local_committer.StateSeqNr() < imsg.StateSeqNr() )
|
{
|
dsp.Log( "Missing message for current state " + [String] local_committer.StateSeqNr() + ". First message is for state" + [String]imsg.StateSeqNr() + " --> Requesting sync", false );
|
// We need to update the StateSeqNr here so that the local_committer will eventually
|
// has the same StateSeqNr as the master commiter. Otherwise, this will be an endless
|
// loop which the process keeps requesting fullsync and master committer keeps sending
|
// new StateSeqNr
|
local_committer.StateSeqNr( imsg.StateSeqNr() );
|
this.RequestSync( local_committer );
|
}
|
else
|
{
|
if ( not is_full_sync_msg and not imsg.Execute( local_committer, soft_error ) )
|
{
|
assert ( soft_error <> "", "Message execution returned false but did not provide error details" );
|
dsp.Log("Soft error '" + soft_error + "' encountered while executing message: " + imsg.GetMessageDescription(), false );
|
}
|
else
|
{
|
if ( is_full_sync_msg and not this.DistributedServiceProviderBase().IsMaster() )
|
{
|
dsp.Log( "Full sync message processed --> Requesting sync", false );
|
this.RequestSync( local_committer );
|
}
|
|
// Message was processed:
|
// 1. Increase state seqnr
|
// 2. Broadcast processed master message and discard processed slave messages
|
dsp.Log( "Executed message: " + imsg.GetMessageDescription(), true );
|
this.SetInboundMessageProcessed( imsg, local_committer );
|
can_continue := true;
|
}
|
}
|
|
if ( soft_error <> "" )
|
{
|
this.ExecuteInboundError( soft_error, true /*is_soft_error*/ );
|
}
|
|
return can_continue;
|
*]
|
}
|