qie.queueInboundMessage¶
Signature: qie.queueInboundMessage(record, originalFilename)
Returns: Integer queuedCount - the number of messages waiting in the in-memory queue to be added (persisted) to the inbound queue
Adds messages to the inbound queue using a multi-threaded process. This allows for higher throughput, but the order that messages are added/processed is not preserved.
Note
Use qie.addInboundMessage instead when message order matters and the channel is configured to process messages in order received.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String or byte[] | record | the message to queue to the inbound queue | |
| String | originalFilename | the source filename |
Examples¶
/* Used when queue order does not matter. If queue order does matter, use addInboundMessage instead. */
// Example: record as String (JSON message)
var jsonMessage = '{"firstName":"Jared","siblings":[{"firstName":"David","age":50},{"firstName":"Michael","age":41}],"lastName":"Jones"}';
var queueSize = qie.queueInboundMessage(
jsonMessage,
'sample.json'
);
// queueSize = number of messages waiting in queue
// Example: record as byte[] (JSON as raw bytes)
var jsonBytes = [
123,34,116,101,115,116,34,58,34,106,115,111,110,32,116,101,115,116,34,125
]; // {"test":"json test"}
queueSize = qie.queueInboundMessage(
jsonBytes,
'sample.json'
);
hl7
// Example: Queue an HL7 message to the inbound queue.
var hl7Message =
`MSH|^~\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|202601281230||ADT^A01|123456|P|2.5
PID|1||123456^^^Hospital^MR||Doe^John||19800101|M|||123 Main St^^Metropolis^NY^10101||555-1234
PV1|1|I|ICU^01^01||1234^Physician^Smith
OBR|1||987654^Lab|CBC^Complete Blood Count
OBX|1|NM|WBC^White Blood Cell Count||5.4|10^3/uL|4.0-10.0|N|||F`;
qie.queueInboundMessage(hl7Message, 'sample.hl7');
// Example: record as byte[] (HL7 as raw bytes)
var hl7Bytes = [
77,83,72,124,94,126,92,38,124,83,101,110,100,105,110,103,65,112,112,124,
83,101,110,100,105,110,103,70,97,99
]; // partial HL7 byte sequence
queueSize = qie.queueInboundMessage(hl7Bytes, 'sample.hl7');
xml
// Example: Queue an XML message to the inbound queue (order does not matter).
var xmlMessage =
`<Patient>
<ID>123456</ID>
<Name>John Doe</Name>
<DOB>1980-01-01</DOB>
</Patient>`;
qie.queueInboundMessage(xmlMessage, 'sample.xml');
// Example: record as byte[] (XML as raw bytes)
var xmlBytes = [
60,80,97,116,105,101,110,116,62,60,73,68,62,49,50,51,52,53,54,60,47,73,68,62,60,47,80,97,116,105,101,110,116,62
]; // <Patient><ID>123456</ID></Patient>
queueSize = qie.queueInboundMessage(xmlBytes, 'sample.xml');