views:

58

answers:

1

Hi there,

I developed a system that consists of software and hardware interaction. Basically its a transaction system where the transaction details are encrypted on a PCI device then returned back to my web based system where it is stored in a DB then displayed using javascript/extjs in the browser. How I do this now is the following:

Transaction encoding process

1.The user selects a transaction from a grid and presses "encode" button,extjs/js then sends the string to PHP where it is formatted and inserted into requests[incoming_request]. At this stage I start a extjs taskmanager to do interval checks on the requests[response] column for a result, and I display a "please wait..." message.

2.I have created a python daemon service that monitors the requests table for any transactions to encode.The python daemon then picks up any requests[incoming_request] then encodes the request and stores the result in requests[response] table.

3.The extjs taskmanager then picks up the requests[response] for the transaction and displays it to the user and then removes the "please wait..." message and terminates the taskmanager.

Now my question is: Is there a better way of doing this encryption process by using 3rd party Messaging and Queuing middleware systems? If so please help.

Thank You!

A: 

I would change it this way:

  • make PHP block and wait until Python daemon finishes processing the transaction
  • increase the timeout in the Ext.data.Connection() so it would wait until PHP responds
  • remove the Ext.MessageBox and handle possible errors in the callback handler in Ext.data.Connection()

I.e. instead of waiting for the transaction to complete in JavaScript (which requires several calls to the webserver) you are now waiting in PHP.

This is assuming you are using Ext.data.Connection() to call the PHP handler - if any other Ext object is used the principle is the same but the timeout setting / completion handling would differ.

m1tk4
Thank You for your reply I will do the changes in my code to see if it will work properly.Although can you provide me with an example of how to do this:1.Make PHP block and wait until Python daemon finishes processing the transaction >>> The daemon basically updates my request table with the result
Chez
In the same PHP handler that inserts the requests in the queue, after the request is inserted, you need to wait until the response is available (or timeout is reached). You basically just loop endlessly (with something like sleep(1) in the loop) and check whether the response is available or not. This essentially "blocks" your PHP request until the response is available.Depending on the scale of your application you may need to configure your Web server to support more concurrent sessions than you currently have. We are talking now 100's of users, not like 10-20.
m1tk4