changeset 890:1af054b77e9c

transfer: load-balancer
author Alain Mazy <am@osimis.io>
date Mon, 07 Nov 2022 14:28:34 +0100
parents e042b29cc901
children ce9218a720db
files Sphinx/source/plugins/transfers.rst
diffstat 1 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Sphinx/source/plugins/transfers.rst	Wed Nov 02 17:50:19 2022 +0100
+++ b/Sphinx/source/plugins/transfers.rst	Mon Nov 07 14:28:34 2022 +0100
@@ -142,7 +142,14 @@
 Here is a sample command line to **receive** a patient from the remote
 peer called ``remote``::
 
-  $ curl -v http://localhost:8042/transfers/pull -X POST -d '{"Resources":[{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],"Compression":"gzip","Peer":"remote"}'
+  $ curl -v -X POST http://localhost:8042/transfers/pull \
+     --data '{
+                "Resources" : [{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],
+                "Compression" : "gzip",
+                "Peer" : "remote"
+              }'
+
+
 
 Note that several resources from different levels (patient, study,
 series or instances) can be retrieved at once.
@@ -150,7 +157,12 @@
 Conversely, here is a sample command line to **send** the same patient
 to the remote peer ``remote``::
 
-  $ curl -v http://localhost:8042/transfers/send -X POST -d '{"Resources":[{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],"Compression":"gzip","Peer":"remote"}'
+  $ curl -v -X POST http://localhost:8042/transfers/send \ 
+     --data '{
+              "Resources" : [{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],
+              "Compression" : "gzip",
+              "Peer" : "remote"
+            }'
 
 The command above is the one that is issued by Orthanc Explorer under
 the hood (see section above).
@@ -239,3 +251,27 @@
       "MaxHttpRetries" : 0       // Maximum number of HTTP retries for one bucket
     }
   }
+
+
+Working with load-balancers
+---------------------------
+
+.. highlight:: bash
+  
+If the receiving Orthanc instance is implemented by a cluster of Orthanc instances
+behind a load-balancer, it is very important that all requests relating to a single
+**"push"** transfer target the same Orthanc instance.
+
+In order to achieve this, in your load-balancer, you may use the ``sender-transfer-id`` 
+HTTP header to route the requests.  This header is populated in every outgoing HTTP request.  
+By default, its value is a random uuid.  If required, you may force the value of this
+HTTP header by adding a ``SenderTransferID`` field in the payload when creating
+the transfer::
+
+  $ curl -v -X POST http://localhost:8042/transfers/send \ 
+     --data '{
+              "Resources" : [{"Level":"Patient","ID":"16738bc3-e47ed42a-43ce044c-a3414a45-cb069bd0"}],
+              "Compression" : "gzip",
+              "Peer" : "remote",
+              "SenderTransferID" : "my-transfer-id"
+            }'