sap4rails 0.07 - SAP RFC and auto-reconnect
I released sap4rails 0.07 this week, which corrects a problem with RFC connections not reconnecting correctly (this is using saprfc as the driver - there is no similar issue wtih the sapwas driver, which uses stateless HTTP). This is especially important when the R/3 (ABAP) application server your Rails application is connected to goes down temporarily (or indeed any other temporary communication disturbance). Before an RFC call is executed, the conection is ping checked, and then a single reconnection attempt is tried if the ping fails. If the reconnect fails then an error is raised so it is a good idea to wrap your code in a rescue block, to deal with the situation in your local conditions. Here is an example log: </p>
... [SapUser] missing_method: Z_BAPI_USER_GETLIST [SapUser] ifaces: ["SUSR_USER_LOCKSTATE_GET", "BAPI_USER_GET_DETAIL", "BAPI_USER_UNLOCK", "BAPI_USER_LOCK", "Z_BAPI_USER_GETLIST"] in check connect... Think Im connected - lets check ... RFC PING[]... Something wrong with connection(1) - do it again ... new connection(2) ... allready connected ... [SapUser] missing_method: Z_BAPI_USER_GETLIST [SapUser] ifaces: ["SUSR_USER_LOCKSTATE_GET", "BAPI_USER_GET_DETAIL", "BAPI_USER_UNLOCK", "BAPI_USER_LOCK", "Z_BAPI_USER_GETLIST"] in check connect... Think Im connected - lets check ... RFC PING[true]... ...
Here you can see the first RFC_PING return nil, and the second after reconnect return [true].
Posted by PiersHarding at October 23, 2006 3:05 PM