jenkins-bot has submitted this change and it was merged.
Change subject: debugging task to import a single fredge message
......................................................................
debugging task to import a single fredge message
Change-Id: I5e673eb31dfb3baee7b4460502f77513bdc35766
---
M sites/all/modules/queue2civicrm/fredge/fredge_queue_consume.drush.inc
1 file changed, 33 insertions(+), 0 deletions(-)
Approvals:
Katie Horn: Looks good to me, approved
jenkins-bot: Verified
diff --git
a/sites/all/modules/queue2civicrm/fredge/fredge_queue_consume.drush.inc
b/sites/all/modules/queue2civicrm/fredge/fredge_queue_consume.drush.inc
index 8bc6380..0782081 100644
--- a/sites/all/modules/queue2civicrm/fredge/fredge_queue_consume.drush.inc
+++ b/sites/all/modules/queue2civicrm/fredge/fredge_queue_consume.drush.inc
@@ -21,6 +21,17 @@
),
'aliases' => array( 'fqc' ),
);
+ $items['fredge-process-messagefile'] = array(
+ 'description' =>
+ 'Feeds a single message directly into the import pipeline,
bypassing the queue.',
+ 'arguments' => array(
+ 'type' => 'Either "init" or "fraud"',
+ 'path' => 'The JSON file containing the message',
+ ),
+ 'required-arguments' => true,
+ 'examples' => array( 'drush fpm init /tmp/blurr.json' => '# process
the file' ),
+ 'aliases' => array( 'fpm' ),
+ );
return $items;
}
@@ -58,3 +69,25 @@
}
}
+function drush_fredge_queue_consume_fredge_process_messagefile( $type, $path )
{
+ watchdog( 'queue2civicrm', "Processing input file @path and feeding to
queue2civicrm_import.",
+ array( '@path' => realpath( $path ) ), WATCHDOG_INFO );
+ $contents = file_get_contents( $path );
+
+ $msg = new stdClass();
+ $msg->headers = array(
+ 'correlation-id' => mt_rand(),
+ );
+ $msg->body = $contents;
+
+ switch ( $type ) {
+ case 'init':
+ module_invoke( 'fredge', 'payments_init_process_message', $msg );
+ break;
+ case 'fraud':
+ module_invoke( 'fredge', 'payments_antifraud_process_message', $msg );
+ break;
+ default:
+ throw new Exception( "Unsupported queue type: $type" );
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/178277
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5e673eb31dfb3baee7b4460502f77513bdc35766
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits