سؤال

أنا أبحث عن تنفيذ بروتوكول الالتزام بمرحلة 2 ونعم أنا جديد على المعاملات الموزعة :) يجب أن يتم تنفيذ الالتزام 2 المرحلة المنفذة بين تطبيق PHP و "تطبيق" بعيد (النظام).

هل يجب علي تنفيذ ارتكاب المرحلة 2 من الصفر؟هل أنت على دراية بأي وحدات يتم تنفيذها بأي لغة يمكن أن تعطيني بداية؟

- لا يمكن العثور على الكثير على هذا حتى الآن :)

نقدر أي مساعدة.

هل كانت مفيدة؟

المحلول

Take a look to LIXA Transaction Manager (http://lixa.sourceforge.net/) it integrates PHP and MySQL starting with release 0.9.0

It provides Distributed Transaction Processing and two phase commit feature as well.

Regards

Ch. F.

نصائح أخرى

Maybe you could have a look at Atomikos, which is an open source implementation for distributed transactions in java. Furthermore you might want to read about the JTA to get some more pieces of information about distributed transactions.

Basically 2-phase-commit (2PC) is not very difficult to understand in theory:

  • all participating systems are asked if they are able to commit now
  • all of those systems have to answer yes/no whereas a yes means that from that moment on a commit must go through
  • when all systems gave their okay they will execute the commit and that's it
  • in case one system disagrees all systems have to roll back
  • the coordinating system should expect to reach an okay within a certain time frame otherwise it should treat it as disagree to commit

Check the Enduro/X middleware. It has a two phase commit implemented too. By using underlying XA infrastructure and on top they provide XATMI, tpopen(), tpbegin(), tpcommit(), tpend() calls. Some conceptual diagram is found on enduro.org site. Transaction manager sources are here. Note that it is using XATMI infrastructure to coordinate with other transaction manager - they are represented as services. See XA decision state machine.

See Enduro/X PHP Client, maybe you can use something from this. Probably XATMI service support can be coded too for PHP.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top