[][src]Crate ainoio_agent

Aino.io agent for the Rust programming language.

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.

Example

use std::time::SystemTime;

// Load the configuration
let config = ainoio_agent::AinoConfig::new()?;

// Start the Aino agent
// This must be called exactly once before any transactions are sent
ainoio_agent::start(config)?;

let timestamp = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();

// Create transaction object
let mut transaction = ainoio_agent::Transaction::new("SAP".to_string(),
    "Card Management".to_string(), "Payment".to_string(), ainoio_agent::Status::Success,
    timestamp.as_millis(), "flow id".to_string());
transaction.message = Some("Data transfer successful.".to_string());
transaction.payload_type = Some("Product Update".to_string());

let metadata = ainoio_agent::TransactionMetadata::new("Card API".to_string(), "https://somecardsystem.com".to_string());
transaction.add_metadata(metadata);

let id = ainoio_agent::TransactionId::new("OrderId".to_string(), vec!["123456".to_string(), "xxasd".to_string()]);
transaction.add_id(id);

// Add the transaction into the queue, it will be sent after `send_interval' has elapsed at the latests
ainoio_agent::add_transaction(transaction).expect("Failed to add transaction to the send queue.");

Structs

AinoConfig

The configuration needed for the Aino.io agent.

AinoError

Error object for Aino.io agent

Transaction

A log entry for a single Transaction between two applications.

TransactionId

Container for IDs of a single type.

TransactionMetadata

A name/value pair for generic metadata.

Enums

Status

An enumeration of the different Status values.

Functions

add_transaction

Adds the Transaction to the queue to be sent later.

start

Starts the Aino.io agent. Should only be called once at application startup.

stop

Stops the Aino.io agent. Adding any new Transactions will result in an error. This function will wait until all pending Transactions have been sent.