Created
November 5, 2014 20:51
-
-
Save bwestergard/d548378cbc034d4df026 to your computer and use it in GitHub Desktop.
AMQP Tester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var env = process.env; | |
var cfg = { | |
foo: env.FOO_QUEUE || 'foo', | |
pattern: env.BIND_QUEUE_PATTERN, | |
amqpUrl: env.RABBIT_MQ_URL | |
}; | |
cfg.channel = { | |
// Channel method to invoke | |
assertQueue: [ // Array of channel method invocations | |
[ cfg.foo ], // Arguments applied to the first method invocation | |
] | |
}; | |
var amqp = require('amqp.channel'); | |
amqp(cfg.amqpUrl, {}).then(function(channel){ | |
for (var i = 0; i <= 10; i++) { | |
var payload = { | |
"bio_id": "W000805", | |
"fields": { | |
"$TOPIC": "topic", | |
"$NAME_FIRST": "Anton", | |
"$NAME_LAST": "Pannekoek", | |
"$ADDRESS_ZIP5": "22305", | |
"$ADDRESS_STREET": "3201 landover st", | |
"$ADDRESS_STATE_POSTAL_ABBREV": "VA", | |
"$NAME_FULL": "Anton Pannekoek", | |
"$PHONE": "703 555 1917", | |
"$PHONE_PARENTHESES": "(703) 555-1917", | |
"$ADDRESS_STATE_FULL": "Virginia", | |
"$ADDRESS_COUNTY": "Alexandria City", | |
"$ADDRESS_ZIP4": "1944", | |
"$ADDRESS_ZIP_PLUS_4": "22305-1944" | |
} | |
}; | |
payload.fields.$NAME_FULL = payload.fields.$NAME_FULL + ' ' + i; | |
channel.sendToQueue('submitToCF', new Buffer(JSON.stringify(payload))); | |
} | |
console.log("DONE SENDING\n\n"); | |
return channel; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment