When using queue.push{}, a message is added to the end of a component's queue. This message is then available to any component that can dequeue and process it, following a first-in, first-out (FIFO) order.
When using message.send{} the message is sent directly to the main function of the target component’s Translator using a component GUID. The message is only available to the target component.
Â
When choosing a method consider the following:
queue.push: Ideal for architectures where multiple components need to process the same message - ie. one-to-many communication. For example, one component might generate a patient record update, and several other components (billing, reporting, etc.) may need access to it.
message.send: Ideal for architectures where only a specific component should process the message.
queue.push: Since the message is written to the queue’s journal file, it can persist even through system restarts, ensuring no messages are lost.
message.send: Since the message is sent directly to the Translator and not stored in a queue, it is not saved to disk. If a system failure occurs before the message is processed, it could be lost. We recommend manually logging the message using iguana.log(). See Custom Logging.
queue.push: Writing to the journal file involves disk input/output (I/O), which can be slow and resource-intensive. This overhead is acceptable for reliable, persistent message processing but may affect performance when speed is critical.
message.send: Since the message is sent directly to the target component without writing to the queue's journal file, there is no file I/O involved, making this method faster and more efficient.