abstract class EnsLib.RecordMap.Operation.BatchStandard extends EnsLib.RecordMap.Operation.StandardBase class for writing out RecordMap batches. The batch will be written to a temporary file, and the ProcessTempFile()() callback will be invoked when complete to allow subclasses to transmit the batch to its destination.
parameter RolloverKeepalive = 1;
Interval to use for checking schedule-based Rollover status. See the comments for RolloverSchedule for more detailed information.
parameter SETTINGS = UnSwizzleRecords,UseDefaultBatch:Basic,DefaultBatchClass:Basic,WriteEmptyBatches:Basic,OpenMode,ReOpenMode,RolloverSchedule:Basic,RolloverLimit:Basic,DelayDefaultBatchOutput:Basic,IntermediateFilePath:Basic;
Inherited description: List of properties can be set as settings in the configuration file format is a comma separated list of property names
property DefaultBatchClass as Ens.DataType.Class;
The classname of the Batch class to be used for the default Batch.
Property methods: DefaultBatchClassDisplayToLogical(), DefaultBatchClassGet(), DefaultBatchClassIsValid(), DefaultBatchClassLogicalToDisplay(), DefaultBatchClassLogicalToOdbc(), DefaultBatchClassNormalize(), DefaultBatchClassSet()
property DelayDefaultBatchOutput as %Boolean [ InitialExpression = 0 ];
When UseDefaultBatch is true, this flag controls whether data is appended to a temporary file as each record arrives, or whether all the data is written out to the temporary file when the batch is rolled over.
Property methods: DelayDefaultBatchOutputDisplayToLogical(), DelayDefaultBatchOutputGet(), DelayDefaultBatchOutputIsValid(), DelayDefaultBatchOutputLogicalToDisplay(), DelayDefaultBatchOutputNormalize(), DelayDefaultBatchOutputSet()
property IntermediateFilePath as %String (MAXLEN = 1000);
The directory to use when creating a temporary file to write out the contents of a batch. If no directory is specified, then the temporary file location for the namespace is used. When the instance is running as part of a failover cluster or mirror with a shared or replicated disk, this path should be on a file system that is visible to both instances, as the operation uses an intermediate file to collect record data as each record is processed by the operation. When a batch object is sent to the operation or when DelayDefaultBatchOutput is true and a default batch is rolled over, the intermediate file is only used for a short interval before being handed off to the adapter for transmission. When individual records are sent to the operation, the intermediate file will be in use until the operation receives a trigger to output the entire batch, which may be many hours after the first record is received.
Property methods: IntermediateFilePathDisplayToLogical(), IntermediateFilePathGet(), IntermediateFilePathIsValid(), IntermediateFilePathLogicalToDisplay(), IntermediateFilePathLogicalToOdbc(), IntermediateFilePathNormalize(), IntermediateFilePathSet()
property OpenMode as %String [ InitialExpression = "RWN" ];
Mode to open the temporary file with when creating a new file for a batch. See the documentation for %IO.FileStream and file devices for more information on the available options.
Property methods: OpenModeDisplayToLogical(), OpenModeGet(), OpenModeIsValid(), OpenModeLogicalToDisplay(), OpenModeLogicalToOdbc(), OpenModeNormalize(), OpenModeSet()
property ReOpenMode as %String [ InitialExpression = "RW" ];
Mode to open the temporary file with when reopening an existing file for a batch. See the documentation for %IO.FileStream and file devices for more information on the available options.
Property methods: ReOpenModeDisplayToLogical(), ReOpenModeGet(), ReOpenModeIsValid(), ReOpenModeLogicalToDisplay(), ReOpenModeLogicalToOdbc(), ReOpenModeNormalize(), ReOpenModeSet()
property RolloverLimit as %Integer (MINVAL = 0) [ InitialExpression = 0 ];
Provide a limit to the number of messages which will be included in the current default Batch. UseDefaultBatch must be enabled for this setting to take effect. If this number is 0, the application will be reponsible for enforcing batch rollovers by either sending BatchRolloverRequest messages from other components or by making use of the RolloverSchedule property. Note that this limit is evaluated after checking RolloverSchedule.
Property methods: RolloverLimitDisplayToLogical(), RolloverLimitGet(), RolloverLimitIsValid(), RolloverLimitLogicalToDisplay(), RolloverLimitNormalize(), RolloverLimitSet()
property RolloverSchedule as %String);
A schedule string to control when the default Batch ought to be rolled over. UseDefaultBatch must be enabled for this setting to take effect. The schedule string takes the same format as the standard schedule string for a component, with one exception: only START strings are permitted. At any time when a START is scheduled to occur, the current default Batch will be written out and replaced with a new default Batch. Note that the RolloverSchedule will be evaluated before checking RolloverLimit.
Property methods: RolloverScheduleDisplayToLogical(), RolloverScheduleGet(), RolloverScheduleIsValid(), RolloverScheduleLogicalToDisplay(), RolloverScheduleLogicalToOdbc(), RolloverScheduleNormalize(), RolloverScheduleSet()
property UnSwizzleRecords as %Boolean [ InitialExpression = 1 ];
UnSwizzle each record from memory after it has been written to the output stream. This option is used when processing an entire batch at once.
Property methods: UnSwizzleRecordsDisplayToLogical(), UnSwizzleRecordsGet(), UnSwizzleRecordsIsValid(), UnSwizzleRecordsLogicalToDisplay(), UnSwizzleRecordsNormalize(), UnSwizzleRecordsSet()
property UseDefaultBatch as %Boolean [ InitialExpression = 0 ];
Flag to indicate whether Records which are not assigned to a batch already should be added to a DefaultBatch. This DefaultBatch will be written out either when the operation receives a BatchRolloverRequest or the batch object itself. If RolloverSchedule is used to specify times when a Batch should be rolled over, then the current default Batch will be written out based on the specified schedule.
Property methods: UseDefaultBatchDisplayToLogical(), UseDefaultBatchGet(), UseDefaultBatchIsValid(), UseDefaultBatchLogicalToDisplay(), UseDefaultBatchNormalize(), UseDefaultBatchSet()
property WriteEmptyBatches as %Boolean [ InitialExpression = 0 ];
Control whether Batch objects which contain no records should be written out. Note that this applies to all batches, including the default Batch.
Property methods: WriteEmptyBatchesDisplayToLogical(), WriteEmptyBatchesGet(), WriteEmptyBatchesIsValid(), WriteEmptyBatchesLogicalToDisplay(), WriteEmptyBatchesNormalize(), WriteEmptyBatchesSet()
Check whether the current default Batch needs to be rolled over. This check is not run if UseDefaultBatch is false or if RolloverSchedule is not specified. Note that the check based on RolloverLimit is performed after the record has been written out in PutRecord()().
method CreateDefaultBatch(Output pDefaultBatch As EnsLib.RecordMap.Batch) as %Status
Callback to create a new default Batch. This method can be overridden in subclasses to further initialize the Batch object.
method GetCharEncoding() as %String
Return the expected character encoding to use for the output. The Batch operation uses a temp file to store data prior to writing out the end of the batch, and we need to know what encoding we should use to match the final output encoding. Subclasses that specify alternate character encodings should override this method.
method GetDefaultBatch(Output pDefaultBatch As EnsLib.RecordMap.Batch) as %Status
Get the current default Batch as an object
Helper method to get a temporary filename for intermediate batch output. Users can override this method should they choose to.
method OnFailureTimeout(pRequest As %Library.Persistent, Output pResponse As %Library.Persistent, ByRef pSC As %Status) as %Boolean
Clean up temp file and AppData that might be left.
method OnInit() as %Status
Verify the previous default Batch object if UseDefaultBatch is true, or create a new one if it didn't exist previously. Also validate that the contents of RolloverSchedule are valid.
Callback invoked to check whether a Rollover is required when RolloverSchedule is specified.
method OnMessage(pRequest As %Persistent, Output pResponse As EnsLib.RecordMap.BatchResponse) as %Status
Handle the incoming requests depending on their type. If a Batch is received without being preceded by one of the Records it contains, the entire batch will be written out to the temporary file on disk at once. If a Record precedes its Batch, the Batch header will be written to the temporary file followed by the Record. All Records in this Batch received by the operation will then be appended to the Batch file. When the Batch document itself is received, the Batch trailer will be written to the temporary file and the Batch will be transmitted. If a BatchRolloverRequest is received and UseDefaultBatch is true, the current default Batch will be rolled over and will be treated as if the default Batch was sent in a message.
method ProcessTempFile(pTempFile As %IO.FileStream, pBatch As EnsLib.RecordMap.Batch) as %Status
Callback which subclasses should override. The completed temporary file will be passed to this method when the Batch has been processed.
method PutBatch(pBatch As EnsLib.RecordMap.Batch, Output pResponse As EnsLib.RecordMap.BatchResponse) as %Status
Handle writing out a Batch object, depending on context. See the documentation for the OnMessage() method for more information on the processing order.
method PutRecord(pRecord As EnsLib.RecordMap.Base, Output pResponse As EnsLib.RecordMap.BatchResponse) as %Status
Write out a Record object, depending on the context for the Batch to which the Record belongs.
method SwitchDefaultBatch() as %Status
Create a new batch object if UseDefaultBatch is true. This method has no effect when UseDefaultBatch is false.
method TriggerRollover() as %Status
Trigger a default batch rollover by calling OnMessage()() with a EnsLib.RecordMap.BatchRolloverRequest instance.
Calculate the next rollover time based on the contents of RolloverSchedule.