Replikwando Messages

From ISoft Wiki
Revision as of 18:02, 6 March 2012 by Jmckinstry (talk | contribs)
Jump to navigationJump to search

Replikwando Messages

Replikwando currently has a messaging back-end (using libITMySQLMessageFramework) that allows it to send and receive information. While there are plans for implementing a GUI interface to do this (at which point this documentation will change to reflect that), these sections will get you by.

Usage Examples

Messages

REPLIKWANDO_MESSAGE_REPUSH

Inputs

  • RepushTime (seconds, int, optional) - When to restart. If unspecified, Replikwando will choose
  • PostBack (True/False, enum, optional) - Declares if a response is wanted back. If unspecified, Replikwando will not respond

Outputs

  • Success (True/False, enum) - If Replikwando will really restart
  • Reason (error message, string, opt) - The reason Replikwando won't be restarting, if any

REPLIKWANDO_MESSAGE_RESTART

Inputs

  • PostBack (True/False, enum, optional) - Declares if a response is wanted back. If unspecified, Replikwando will not respond

Outputs

  • None

REPLIKWANDO_MESSAGE_REQUEST_STATUS

Inputs

  • ReplikwandoDataObject (object name, string, optional) - The specific data you wish to get. If unspecified, Replikwando will respond with a generic string. See below for object values

Outputs

  • Value (object value, string) - The object's value, or a generic output if no object was specified

Object Values

REPLIKWANDO_STATUS_OBJECT_STARTED_AT // Returns the date/time Replikwando started at

REPLIKWANDO_STATUS_OBJECT_TOTAL_QUERIES // Total queries executed

REPLIKWANDO_STATUS_OBJECT_QUERIES_IN_MEMORY // Number of queries in memory currently

REPLIKWANDO_STATUS_OBJECT_QUERIES_IN_TABLE // Number of queries in the sqlite table

REPLIKWANDO_STATUS_OBJECT_CURRENT_STATUS // Replikwando's current running status

REPLIKWANDO_STATUS_OBJECT_CURRENT_ERROR // Replikwando's current stopping error. Empty String if everything is okay (Not implemented yet)

REPLIKWANDO_STATUS_OBJECT_REPUSH_TIME // The time Replikwando will re-push. Empty String if no repush is scheduled

REPLIKWANDO_STATUS_OBJECT_MOST_RECENT_QUERY // The most recent query Replikwando has handled (includes both successful and failing queries, and is dependent on the state of Replikwando)

REPLIKWANDO_STATUS_OBJECT_VERSION // Replikwando's static version

REPLIKWANDO_MESSAGE_SKIP_QUERY

Inputs

  • PostBack (True/False, enum, optional) - Declares if a response is wanted back. If unspecified, Replikwando will not respond

Outputs

  • Success (True/False, enum) - True

REPLIKWANDO_MESSAGE_FINISHED_REPUSH

Inputs

  • ToDatabase (table name, string) - The name of the database that had its data finish pushing
  • ToConnection (connection name, string) - The name of the connection that the ToDatabase table can be found in

Outputs

  • None

REPLIKWANDO_MESSAGE_GET_INI

Inputs

  • None

Outputs

  • Value (ini values, string) - The replication.ini file in all its glory.

REPLIKWANDO_MESSAGE_GET_INI_VALUE

Inputs

  • Header (header, string) - The replication.ini value's header
  • Name (setting name, string) - The replication.ini value's name

Outputs

  • Found (True/False, enum) - True if the value was found, and Value will be set, False otherwise and Value will not be set
  • Value (value, string, optional) - The replication.ini's recorded value for [Header]Name, if any

REPLIKWANDO_MESSAGE_SET_INI_VALUE

Inputs

  • Header (header, string) - The replication.ini value's header
  • Name (setting name, string) - The replication.ini value's name
  • Value (setting value, string) - The replication.ini value's actual data

Outputs

  • None

REPLIKWANDO_MESSAGE_UPDATE

Inputs

  • Version (version, string) - The version of Replikwando that the file data represents
  • IsService (True/False, enum) - True if the update included as Data is the service version
  • Data (file data, blob) - The file data that makes up the file. May be very large

Outputs

  • None

Database Interaction

The basic setup of a message being sent to replikwando goes like this:

  1. Initialize the message
  2. If the message requires inputs, add them
  3. Post the message
  4. If you expect a response, check v_responses until you get one
  5. Close the message if you wanted a response

Here are some examples:

Getting Status

SELECT heartbeat.f_message_init('<uuid_handle>') INTO @messageID;

SELECT heartbeat.f_message_post(@messageID, 'REPLIKWANDO_MESSAGE_REQUEST_STATUS', 'False', 'True');

SELECT * FROM heartbeat.v_responses where messageid = @messageID;

Getting Specific Status

SELECT heartbeat.f_message_init('<uuid_handle>') INTO @messageID;

SELECT heartbeat.f_message_attach_data(@messageID, 'Input', 'ReplikwandoDataObject', 'REPLIKWANDO_STATUS_OBJECT_STARTED_AT');

SELECT heartbeat.f_message_post(@messageID, 'REPLIKWANDO_MESSAGE_REQUEST_STATUS', 'True', 'True');

Restarting Replikwando

SELECT heartbeat.f_message_init('<uuid_handle>') INTO @messageID;

SELECT heartbeat.f_message_post(@messageID, 'REPLIKWANDO_MESSAGE_RESTART', 'False', 'False');

Updating Replikwando

SELECT heartbeat.f_message_init('<uuid_handle>') INTO @messageID;

SELECT heartbeat.f_message_attach_data(@messageID, 'Input', 'Version', '<version>');

SELECT heartbeat.f_message_attach_data(@messageID, 'Input', 'IsService', 'False');

CREATE TEMPORARY TABLE t_update_data(`data` MEDIUMBLOB);

<insert the file blob data into `t_update_data`.`data`>

SELECT heartbeat.f_message_attach_data(1446, 'Input', 'Data', `data`) FROM t_update_data;

SELECT heartbeat.f_message_post(@messageID, 'REPLIKWANDO_MESSAGE_UPDATE', 'True', 'False');

Replikwando Statuses

  • OK: Replikwando believes everything is operating as intended.
  • ErrorWaiting: Replikwando is still pushing data and reporting in, but it will need to repush when its scheduled time comes.
  • Stopped: Replikwando has either been turned off at the local computer or has failed to report in for more than an hour.