Archive: Namaste PHP AMQP framework v1.0 (2017-2020)

952 days continuous production uptime, 40k+ tp/s single node.
Original corpo Bitbucket history not included — clean archive commit.
This commit is contained in:
2026-04-05 09:49:30 -07:00
commit 373ebc8c93
1284 changed files with 409372 additions and 0 deletions

78
stubs/testWH.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
/**
* testWH.php -- warehousing test script
*
*/
// load the namaste environment
require_once(dirname(__DIR__) . '/config/sneakerstrap.inc');
const OBJECT = 1;
const BROKER = 2;
// if processing is OBJECT, we can use the debugger
// if processing is BROKER, event is passed to migration broker
$processing = OBJECT;
// set up the data payloads
$meta = [
META_CLIENT => CLIENT_SYSTEM,
// META_TEMPLATE => TEMPLATE_CLASS_PRODUCT_REG, // mongoDB template
META_TEMPLATE => TEMPLATE_CLASS_PROD_REGS, // mySQL template
META_CLIENT_IP => STRING_SESSION_HOME,
META_EVENT_GUID => guid() // simulate a broker event by generating the event guid
];
// data payload for an internal warehousing request
$data = [
MWH_TEST_MODE => 1,
WH_TYPE => WH_TYPE_COOL,
WH_AUTOMATED => false,
WH_FILTER_VALUES => [ '1970-01-01', '2017-02-17' ] // (required) should return 11 records
];
// data payload for an external source request
$remoteData = [
MWH_TEST_MODE => 1,
WH_TYPE => WH_TYPE_COOL,
WH_AUTOMATED => false,
WH_SOURCE_IS_REMOTE => true,
WH_REMOTE_TABLE => 'product_registrations',
WH_REMOTE_CDATE_FIELD => 'kinsert_date',
WH_FILTER_VALUES => [ '1970-01-01', '2017-02-17' ] // (required) should return 11 records
];
if ($processing == OBJECT) {
// $objTest = new gacMigrations($data, $meta, EVENT_WAREHOUSE);
$objTest = new gacMigrations($remoteData, $meta, EVENT_WAREHOUSE);
if (!$objTest->status) {
echo ERROR_TEMPLATE_INSTANTIATE . TEMPLATE_CLASS_MIGRATIONS . $eos;
var_export($objTest->errorStack);
exit(1);
}
// this is what the broker calls:
if (!$objTest->whData()) {
var_export($objTest->errorStack);
exit(1);
}
echo 'program successfully completed execution' . $eos;
echo $objTest->migrationReport;
echo $eos . $eos;
} elseif ($processing == BROKER) {
if (isset($meta[META_EVENT_GUID])) unset($meta[META_EVENT_GUID]);
$bc = new gacBrokerClient(BROKER_QUEUE_W, __METHOD__ . AT . __LINE__);
if (!$bc->status) {
$error = ERROR_BROKER_CLIENT_DECLARE . BROKER_QUEUE_W;
echo $error . $eos;
exit(1);
}
$request = [
BROKER_REQUEST => BROKER_REQUEST_WAREHOUSE,
BROKER_DATA => $remoteData,
BROKER_META_DATA => $meta
];
$response = json_decode(gzuncompress($bc->call(gzcompress(json_encode($request)))), true);
var_export($response);
} else {
echo 'processing type not supported...' . $eos . $eos;
}