com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Extending the Python Cartridge Agent

When developing customized cartridges to run on top of PPaaS the default behaviour of the Python Cartridge Agent (PCA) will not be sufficient. In such cases you can extend the PCA. The extension points provided by the PCA trigger at specific times and allows users to capture events.

Example: PPaaS is currently configured to work with the GIT repository but if you are working with SVN then the PCA must be extended to work with SVN.

 

PCA extensions

The PCA can be extended by implementing the following interfaces:

  • IArtifactCheckoutPlugin

    This interface is implemented and registered as a yapsi plugin to override the default artifact checkout behaviour. It is responsible for cloning the remote repository on receiving the updated artifact event. The extension point is triggered every 10 seconds by default if the auto_checkout setting is set to true.

    The time interval to trigger the extension point is defined in the agent.conf file.

     Extending the iArtifactCheckoutPlugin
    1. Download the apache-stratos-python-cartridge-agent-4.1.4.zip from here.
    2. Navigate to the /plugins directory.
    3. Extending the PCA for artifact management using checkout extension points.

      1. Build your own plugin.
        Example: IArtifactCheckoutPlugin
      2. Navigate to the DefaultArtifactCheckout.py file.
      3. Import the build plugin as an interface to the DefaultArtifactCheckout class.

        class DefaultArtifactCheckout(IArtifactCheckoutPlugin):
  • IArtifactCommitPlugin

    This interface is implemented and registered as a yapsi plugin to override the default artifact commit behaviour. It is responsible for committing modified files and pushing any changes to the remote repository. This extension point is triggered every 10 seconds by default, if the auto_commit setting is set to true.

    The time interval to trigger the extension point is defined in the agent.conf file.

     Extending the IArtifactCommitPlugin
    1. Download the apache-stratos-python-cartridge-agent-4.1.4.zip from here.
    2. Navigate to the /plugins directory.
    3. Extending the PCA for artifact management through the commit extension point.

      1. Build your own plugin.
        Example: IArtifactCommitPlugin
      2. Navigate to the DefaultArtifactCommit.py file.
      3. Import the plugin you built as an interface to the DefaultArtifactCommit class.

        class DefaultArtifactCommit(IArtifactCommitPlugin):
  • ICartridgeAgentPlugin

    This interface is implemented and registered as a yapsi plugin. It will be executed on receiving certain Message Broker (MB) events. When registering the yapsi plugin the MB event to be executed must be specified by setting a property named Description to a comma separated list of MB events in yapsy-plugin config file.

    For more information on the yapsy plugin framework.

     Example

    In this example this specific the event must be executed when the Cartridge Agent Instance starts.

    [Core]
    Name = wso2as-521-startup-handler
    Module = wso2as-521-startup-handler
     
     
    [Documentation]
    Description = InstanceStartedEvent
    Author = wso2
    Version = 0.1
    Website = https://wso2.com
     Available extension points
    Extension pointDescription
    Instance StartedThis is executed just after the Cartridge Agent process is started. This extension point can be used to set any cartridge specific environment variables, install required packages and perform any initial configurations on the cartridge instance.
    Start Servers This is executed just after executing the Instance Started extension script. This extension point can be used to perform any product or component configurations, and start any application servers deployed in the cartridge instance.
    Instance ActivatedThis is executed after all ports are activated and the Instance Activated event is published. This extension point can be used to send any configuration service calls to the cartridge server.
    Artifacts UpdatedThis is executed whenever Artifact Updated event is published by the Autoscaler to Instance Notifier topic.
    CleanThis is executed whenever Instance Cleanup Member event or Instance Cleanup Cluster event is published by Autoscaler to Instance Notifier topic.
    Mount VolumesThis is executed if persistence volume mapping is defined in the cartridge definition.
  • IHealthStatReaderPlugin

    This interface is implemented and registered as a yapsi plugin to override the default read behaviour of the health statistsics. The PCA periodically calculates the memory consumption and load average, and publish them to the CEP every 15 seconds. This plugin is responsible for reading the aforesaid values.

 

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.