function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AutobatAutobat 

Thread Safety with a Callout - Need a reference from the DB but cant commit

Hey Guys,

 

I understand the inability to commit DB changes (no updates or inserts) before you can make a callout.  This however is a monumental problem.....

 

Scenario:

Drupal passes personal and payment details to Salesforce via SOAP.  Salesforce sends payment details to bank and returns message back to drupal with success or error.

 

Problem:

Because i cant commit anything to the database before making the call out there is no way for me to make the application thread safe as i need to reserve a unique reference for the payment (client wants sequential references).

 

So my question, is there a way for me to make this thread safe?  e.g. how do i stop 2 website users sending in a payment at exactly the same time and the system using the same reference for both?  Or is the only way i can do this is by making the client move away from sequential references and I construct one from some source or another?

 

Many thanks,

 

Chris