Skip to content

A transformation action the replays metric events to simulate a large number of agents

License

Notifications You must be signed in to change notification settings

scalingdata/rocana-metric-load-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rocana Transform Action Plugin Example

This project demonstrates how to build a plugin for the Rocana transformation engine. Plugins can perform arbitrary processing on event data within the system.

Before you start, we assume the following:

  • An intermediate knowledge of Java 7 or later.
  • An intermediate understanding of Apache Maven.
  • A basic understanding of JUnit.

A transformation plugin consists of two primary classes: an Action and an ActionBuilder.

An implementation of the Action interface contains the logic for how to process individual events. Actions are free to contain any kind of logic, although they should avoid expensive calls to external services or APIs as they are executed for every event that passes through the system. See the class MyAction in this project for a simple Action that uppercases a message and sets a context variable other Actions may reference later in the transformation.

An ActionBuilder implementation is responsible for holding configuration information and creating new instances of an appropriate Action. In almost all cases, there is a one to one relationship between Actions and ActionBuilders. ActionBuilders are annotated with Rocana Configuration annotations that specify configuration property names and types. See MyActionBuilder in this project for a simple example of an ActionBuilder.

Upon startup, the Rocana transformation engine uses the Java ServiceLoader facility to find and instantiate ActionBuilders. This is how ActionBuilders are found at runtime. If you're not familiar with the ServiceLoader facility, you can get away with just specifying the fully qualified class name of the ActionBuilder implementation in the file named com.rocana.transform.conf.ActionBuilder in the src/main/resources/META-INF/services/ directory in this project.

An example configuration that uses MyAction is provided in src/test/resources/test-my-action.conf.

Finally, a test of the MyAction plugin TestMyAction is included. This test mimics how Rocana components invoke the transformation engine making it suitable to test custom Actions. You may customize the types of events used as inputs to the transformation engine to test specific use cases.

Building the Project

This project is managed by Maven.

To build the project, run its tests, and assemble its output, run:

mvn package

To clean any temporary build files, run:

mvn clean

To build the project and assemble its output, but skip tests, run:

mvn package -DskipTests

License

This project is licensed under the Apache License 2.0. See the included LICENSE file for full details.

About

A transformation action the replays metric events to simulate a large number of agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages