Skip to content
Jim Cowart edited this page Jan 16, 2013 · 1 revision

postal.fedx.sendMessage( envelope ) is a top level method that acts as the main gateway to send messages to all transports/remote instances of postal. If the local instance of postal is ready - meaning it has a postal.instanceId() value, then it simply iterates over each transport and calls the transport specific sendMessage method. It's up to each transport to provide a specific/concrete implementation of how to send. If the local instance of postal is not ready, then any envelopes passed to sendMessage are queued up in the _outboundQueue and will be replayed (to attempt a send again) once the local instance of postal is ready.

It's important to note that this method - like many of the others exposed via postal.fedx namespace - will hardly (if ever) need to be called in your code. postal.federation stands up a wire tap in your local instance of postal and calls this method inside the wire tap, so it's called automatically for you any time a message is published that matches an outbound filter rule.