Package com.mxraven.mail.notify
When notifications are enabled for a listener (see the admin
module's listener notification setting), mxRaven publishes every accepted
message and every delivery attempt to that listener's durable JetStream
consumer. This package consumes those events with the listener's ordinary
API key:
NotificationClient client = NotificationClient.connect(
NotificationClientOptions.builder()
.username("mxr_tx_ab12cd34ef56")
.secret(System.getenv("MXRAVEN_SECRET"))
.listener(listenerId)
.build());
client.consume(new NotificationCallbacks() {
@Override
public HandlerResult onAttempt(AttemptEvent event) {
System.out.println(event.status());
return HandlerResult.CONTINUE;
}
});
NotificationClient.consume(com.mxraven.mail.notify.NotificationHandler) acknowledges an
event when its handler returns, redelivers it with exponential backoff when
the handler throws, and stops when the handler returns
HandlerResult.STOP.
NotificationClient.events() is the
lower-level iterator for callers that acknowledge each event themselves.
Fault events are described by FaultEvent: an
MTA listener's routing script faulted and deferred the transaction, so there
is no accepted event. They are sampled per script revision.
Accepted events are described by AcceptedMessage:
the message summary and headers, the SMTP envelope, the routing-script
decision, and raw-message access. An MTA listener's accepted event carries a
RawEmail that
AcceptedMessage.parse() downloads; a
submission listener's event leaves it empty. Attempt events are described by
AttemptEvent.
The consumer and its subject are managed by the control plane. Enable
notifications with the administrative API before connecting; the consumer
name defaults to notify-<listener>.
-
ClassDescriptionA message a listener accepted.A message the listener accepted and whose routing-script decision was resolved.Identifies the egress worker that produced an attempt event.One delivery attempt for an accepted message.One delivery attempt for an accepted message.The SMTP envelope of an accepted message.Reports that an MTA listener's routing script faulted and the message was deferred, so no accepted event exists to carry the fault.A sampled routing-script fault from an MTA listener.The value a notification handler returns.One parsed message header occurrence.A summary of the parsed RFC 5322 headers of an accepted message.Typed
NotificationHandlerfor when you handle specific event kinds.Consumes one listener's mxRaven client notification events over NATS JetStream.BuildsNotificationClientOptionsinstances.A notification body did not match the SDK's payload model.One event yielded by aNotificationIterator.A decoded client notification.A client notification connection or consume operation failed.Processes one notification event.Iterates one listener's notification events without automatic acknowledgement.Identifies which kind of notification an event carries.Time-limited access to the raw RFC 822 message of an accepted notification.What a listener's routing script did for one accepted message.Why a routing script faulted and the listener-type default applied.The audit record of onemx.httpcall.One effect a routing script staged.The kind of effect a routing script staged.A non-terminal effect an execution-time check skipped.The lifecycle state reported by a delivery-attempt event.The final routing action a listener's script resolved.Spam and malware scan results attached to an accepted message.