Create a Custom MDC

In this task, you create a custom MATRIXX Data Container (MDC) with fields (type, amount, color) to extend the base MtxPurchasedOffer MDC.

About this task

This task only details the information necessary to create the DemoPurchasedOfferExtension MDC used in the sample project. For detailed information about creating a custom MDC, see the discussion about adding custom MDCs in MATRIXX Configuration.

For more information about the MATRIXX environment variables, see the discussion about container directories and environment variables in MATRIXX Installation and Upgrade.

Procedure

  1. Use a configuration source to configure the grouped AVP in create_config.info. You must delete the following create_config.info question:
    Do you want to add any private MDCs (y/n)?

    The MATRIXX Engine configuration source can configure multiple configuration files to be merged at start-up as inputs for the create_config.py command. Files are loaded in alphabetical order. Each filename must end in create_config.info.

    For more information about configuration using a configuration source, see the discussion about configuration sources in MATRIXX Configuration.
  2. Run create_config.py.
    For example:
    kubectl exec -it engine_pod_name -n matrixx -- bash --login -c "create_config.py"
  3. When you are prompted to add any custom (private) MDCs, answer y and provide the following information.
    Do you want to add any private MDCs?y
    How many private MDCs do you want to add?1
    Added MDC:00001:What is the container's name?DemoPurchasedOfferExtension
    Added MDC:00001:What is the container's key?-1
    Added MDC:00001:What is the name of the base container (if any)?MtxPurchasedOfferExtension
    Added MDC:00001:What is the created schema version?2
    Added MDC:00001:What is the deleted schema version?0
    New DemoPurchasedOfferExtension field:How many fields do you want to add?3
    New DemoPurchasedOfferExtension field:00001:What is the field's name?Type
    New DemoPurchasedOfferExtension field:00001:What is the field's type?string
    New DemoPurchasedOfferExtension field:00001:What is the field's max-size?15
    New DemoPurchasedOfferExtension field:00001:Is this field a list (y/n)?n
    New DemoPurchasedOfferExtension field:00001:Is this field an array (y/n)?n
    New DemoPurchasedOfferExtension field:00001:What is the created schema version?2
    New DemoPurchasedOfferExtension field:00001:What is the deleted schema version?0
    New DemoPurchasedOfferExtension field:00002:What is the field's name?Amount
    New DemoPurchasedOfferExtension field:00002:What is the field's type?decimal
    New DemoPurchasedOfferExtension field:00002:Is this field a list (y/n)?n
    New DemoPurchasedOfferExtension field:00002:Is this field an array (y/n)?n
    New DemoPurchasedOfferExtension field:00002:What is the created schema version?2
    New DemoPurchasedOfferExtension field:00002:What is the deleted schema version?0
    New DemoPurchasedOfferExtension field:00003:What is the field's name?Color
    New DemoPurchasedOfferExtension field:00003:What is the field's type?string
    New DemoPurchasedOfferExtension field:00003:What is the field's max-size?15
    New DemoPurchasedOfferExtension field:00003:Is this field a list (y/n)?n
    New DemoPurchasedOfferExtension field:00003:Is this field an array (y/n)?n
    New DemoPurchasedOfferExtension field:00003:What is the created schema version?2
    New DemoPurchasedOfferExtension field:00003:What is the deleted schema version?0
    
    Note: Configuring the max-size field can cause a SubMan request to fail if the field value is greater than the configured max-size.
    The following information is added to the $MTX_CONF_DIR/mdc_config_custom.xml file.
    <container id="DemoPurchasedOfferExtension">
      <key>-1</key>
      <created_schema_version>2</created_schema_version>
      <base_container id="2">MtxPurchasedOfferExtension</base_container>
      <field id="Type">
          <created_schema_version>2</created_schema_version>
          <datatype>string</datatype>
          <max_size>15</max_size>
      </field>
      <field id="Amount">
          <created_schema_version>2</created_schema_version>
          <datatype>decimal</datatype>
      </field>
      <field id="Color">
          <created_schema_version>2</created_schema_version>
          <datatype>string</datatype>
          <max_size>15</max_size>
      </field>
      <!-- extra DemoPurchasedOfferExtension container fields go here -->
      <storage_size>large</storage_size>
    </container>
  4. Copy the $MTX_CONF_DIR/mdc_config_custom.xml file from the engine and place it in the root of the project (/projects/purchase/).
    For example, on the engine, type:
    scp ${MTX_CONF_DIR}/mdc_config_custom.xml matrixxsw@mdc_proxy_address:/home/mtx/mtxsdk/projects/purchase

    This ensures that when the project is built, the data services code generator can create JAVA files for the custom MDC.