Skip to content

Unikie/agent-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Agent for Aino.io

Build status

Java implementation of Aino.io logging agent.

What is Aino.io and what does this Agent have to do with it?

Aino.io is an analytics and monitoring tool for integrated enterprise applications and digital business processes. Aino.io can help organizations manage, develop, and run the digital parts of their day-to-day business. Read more from our web pages.

Aino.io works by analyzing transactions between enterprise applications and other pieces of software. This Agent helps to store data about the transactions to Aino.io platform using Aino.io Data API (version 2.0). See API documentation for detailed information about the API.

Technical requirements

  • Java 7

Example usage

Before using the agent, it needs to be configured. Agent can be configured manually or via configuration file.

1. Get the Java Agent jar

You have two options:

a) Add as a Maven/Gradle/Ivy dependency to your project. Get the dependency snippet from here.

b) Download it manually from here.

2. Configuring the agent

Agent is configured with an XML configuration file. Below is an example.

If you cannot establish a direct connection to Aino.io, you can configure the agent to use an HTTP proxy. Otherwise you may simply leave the proxy element out from the configuration.

File configFile = new File("/path/to/conf_file.xml");
Agent ainoLogger  = Agent.getFactory().setConfigurationBuilder(new FileConfigBuilder(configFile)).build();
Configuration file example
<ainoConfig>
    <ainoLoggerService enabled="true">
        <address uri="https://data.aino.io/rest/v2.0/transaction" apiKey="YOUR API KEY GOES HERE"/>
        <!-- Optional: Define proxy server address and port if your environment requires it -->
        <!--<proxy host="127.0.0.1" port="8080" /> -->
        <send interval="5000" sizeThreshold="30" gzipEnabled="true" />
    </ainoLoggerService>
    <operations>
        <operation key="create" name="Create" />
        <operation key="update" name="Update" />
        <operation key="delete" name="Delete" />
    </operations>
    <applications>
        <application key="app01" name="TestApp 1"/>
        <application key="app02" name="TestApp 2" />
    </applications>
    <idTypes>
        <idType key="dataType01" name="Data Type 1" />
        <idType key="dataType02" name="Data Type 5" />
    </idTypes>
    <payloadTypes>
        <payloadType key="subInterface01" name="Interface 1" />
        <payloadType key="subInterface02" name="Interface 2" />
    </payloadTypes>
</ainoConfig>

3. Send a request to Aino.io:

Minimal example (only required fields)

Logging is done by creating a Transaction object and passing it to the agent:

// Create transaction object
Transaction transaction = ainoLogger.newTransaction();

// .. add data to transaction object
transaction.setToKey("application1");
transaction.setFromKey("application2");
transaction.setStatus("success");

// Send entry to aino.io
ainoLogger.addTransaction(transaction);                // Do the actual logging to aino.io

Full example

Logging is done by creating a Transaction object and passing it to the agent:

// Create transaction object
Transaction transaction = ainoLogger.newTransaction();

// add data to transaction object
transaction.setFlowId("1249F41E55A1123FB");
transaction.setToKey("application1");
transaction.setFromKey("application2");
transaction.setStatus("success");
transaction.setMessage("Data transfer successful.");
transaction.setOperationKey("operation1");
transaction.setPayloadTypeKey("payloadType1");
transaction.addMetadata("Extra data", "Oh sleep! it is a gentle thing, Beloved from pole to pole!");

// add ids that identifies the logged data
List<String> idValues = new ArrayList<String>();
list.add("1");
list.add("2");
list.add("3");
transaction.addIdsByTypeKey("key1", idValues);

// Send entry to aino.io
ainoLogger.addTransaction(transaction);                // Do the actual logging to aino.io

Contributing

Technical requirements

  • Java 7
  • Maven 3.X

Contributors

Copyright © 2016 Aino.io. Licensed under the Apache 2.0 License.