From f1cdd72110184460f76630db79ce6fc0ead44ba6 Mon Sep 17 00:00:00 2001
From: Anders Svensson
Date: Fri, 18 Jan 2019 13:22:31 +0100
Subject: Tweak/document request handler callback
The possibility of configuring an MFA as spawn_opt was added in commit
fd285079, the callback being passed an arity-0 fun to be applied in an
appropriate handler process. Replace the fun by a tuple to be passed to
diameter_traffic:request/1, to avoid passing funs between nodes when
handler processes are remote.
A list-valued spawn_opt is now equivalent to the following configured as
{spawn_opt, {Mod, spawn_local, [Opts]}}.
spawn_local(ReqT, Opts) ->
spawn_opt(diameter_traffic, request, [ReqT], Opts).
ReqT is passed by diameter and contains information that the callback
may want to decide where to handle the request in question (which wasn't
accessible with a fun), but this information isn't exposed in a
documented way. The intention is instead to add an own callback
implementation to make use of the information.
Note that application lookup now takes place in the watchdog process in
both the list-valued (or no configuration) and mfa-valued cases. Whether
this is good, bad, or (probably) inconsequential remains to be seen.
---
lib/diameter/doc/src/diameter.xml | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
(limited to 'lib/diameter/doc/src')
diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml
index dfa4c803ed..b98e55d2bf 100644
--- a/lib/diameter/doc/src/diameter.xml
+++ b/lib/diameter/doc/src/diameter.xml
@@ -1,7 +1,9 @@
erlang:spawn_opt/2'>
+ erlang:spawn_opt/5'>
erlang:nodes/0'>
2011
-2017
+2019
Ericsson AB. All Rights Reserved.
@@ -1384,12 +1386,22 @@ the same peer.
-{spawn_opt, [term()]}
+{spawn_opt, [term()] | {M,F,A}}
-
-Options passed to &spawn_opt; when spawning a process for an
-incoming Diameter request.
-Options monitor and link are ignored.
+An options list passed to &spawn_opt2; to spawn a handler process for an
+incoming Diameter request on the local node, or an MFA that returns
+the pid of a handler process.
+
+
+Options monitor and link are ignored in the list-valued
+case.
+An MFA is applied with an additional term prepended to its argument
+list, and should return either the pid of the handler process that
+invokes diameter_traffic:request/1 on the term in order to
+process the request, or the atom discard.
+The handler process need not be local, but diameter must be started on
+the remote node.
Defaults to the empty list.
--
cgit v1.2.3