Description
The SegmentPartitionReceiver morphs Domain data into a set-based XML output format, to one or more files created over multiple instances via the GenRocket Partition Engine. This allows for huge amounts of data to be generated, in parallel, quickly and also allows multiple Scenarios to produce their own sets of Domain data while maintaining set-based parent/child relationships across multiple related Domains. Any of the GenRocket Merge Receivers can consume multiple XML Segmented data and merge them into nested formatted data (e.g. XML, JSON, SOAP, HL7, EDI, etc.).
In This Article
- Parameters
- Receiver Attribute Property Keys
- Step 1: Assign the SegmentPartitionReceiver to the Domain
- Step 2: Configure Receiver Parameters
- Step 3: Create a Scenario for the Domain and Download the Scenario
- Step 4: (Optional) Create Additional Domains and Scenarios to Merge
- Step 5: Run the Scenario using the Partition Engine
Parameters
The following parameters can be defined for the SegmentPartitionReceiver. Items with an asterisk (*) are required.
- outputPath* - Defines the location to store the generated partition file.
- subDirectory - Defines the name of a sub-directory defined as the value of the outputPath for the Partition Segment files.
- fileName* - Defines the name of the generated partition segment file.
- filesPerDirectory* - Defines the number of files that will be created per output sub-directory.
- recordsPerFile* - Defines the number of segments to be generated per file.
- serverNumber* - Defines the server instance number where the Receiver will be running and helps the Receiver determine the output directory structure where it will deposit the generated data files. This Receiver is meant to be used in Scenarios that are run by the GenRocket GPartition engine to generate huge amounts of data; thus, this parameter will automatically be set by the GPartition engine.
- instanceNumber* - Defines the runtime instance number on a given server instance where the Receiver will be running and helps the Receiver determine the output directory structure where it will deposit the generated data files. This Receiver is meant to be used in Scenarios that are run by the GenRocket GPartition engine to generate huge amounts of data; thus, this parameter will automatically be set by the GPartition engine.
- h2DBServerMode - Defines whether H2 database connection is in server mode or client mode when any attribute to accumulate.
Receiver Attribute Property Keys
The Receiver defines three property keys that can be modified on any of its associated Domain Attributes:
- include - Determines if the Attribute will be included as a column in the output.
- parentId - This property key should be set to False except for the Attribute that referenced the Parent Attribute.
- aliasName - Defines an alias for the Attribute. Defaults to the same name as the Attribute.
- accumulate - Defines whether to accumulate the value for the current Attribute or not. If any attribute is set to accumulate true then GenRocket will create an H2 database with the name #{DOMAIN.NAME}_segment and a table with the Domain name and columns with the name of attributes having the accumulated value true. Example: If Domain name is Transaction and amount Attribute needs to be accumulated, then the Database transaction_segment will be created in .genrocket folder, the table name will be transaction and column will be amount. If Domain has its parent then it will create parent reference as well as in this example we had BatchHeader and FileHeader therefore all columns like id bigint, amount decimal(10,2), batchheader_id bigint, and fileheader_id bigint.
Step 1: Assign the SegmentPartitionReceiver to the Domain
The SegmentPartitionReceiver can be used to generate a complex file format with a large volume of data for a particular Domain.
- Select the Domain within the Project Dashboard.
- Click on the Add Receiver button within the Domain Dashboard.
- Select the SegmentPartitionReceiver within the pop-up window.
- Click Save in the dialog window.
Note: To view the complete steps for assigning a new Receiver to a Domain, click here.
Step 2: Configure Receiver Parameters
Next, the SegmentPartitionReceiver Parameters will need to be configured. Click on each field to enter or modify the value. An example configuration is shown below:
Note: When a sub-directory is defined, it will be the location where the partition segments are created for each server/instance. This will need to be specified in the config file to merge the partition segment (See Step 4 for more details).
Step 3: Create a Scenario for the Domain and Download the Scenario
A Scenario will need to be created for the Domain and downloaded to run it using the Partition Engine. To learn how to create a Scenario for a Domain, click here.
Once created, click on the Download (Cloud) Icon to download the Scenario to your local machine.
Step 4: (Optional) Create Additional Domains and Scenarios to Merge
After creating the Partition Segment, you can create other Domains and Scenarios that can be merged using a Merge Scenario.
The created MergeScenario will merge the segments into a specified format. An example is shown below:
To drop tables created by the SegmentPartitionReceiver, create a separate domain and assign SQLUpdateReceiver and specify drop as in the below screenshot:
Now, create a scenario and add this scenario to the last in the cenario chain.
A config file will also need to be created to merge the segments. An example config file is shown in the screenshot below.
Important: If a sub-directory has been defined within the Parameter configuration (Step 2), you will need to specify the sub-directory in which the Partition Segments created for each server/instance within the config file to notify the merge receivers.
Step 5: Run the Scenario using the Partition Engine
Click here to view the complete steps for running a Scenario with a partition engine.