-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Status of server support #209
Comments
Hello @samuel-c-allan, the sever functionality is not yet available and please ignore the old The commented code Server.cc#173 are three main steps of processing ABAP to Node RFC call:
The cycle is basically "inverted" client request cycle, in which steps 1) and 3) are exchanged. In client case JS data are converted to ABAP RFC input and ABAP RFC results is converted back to JS. These conversions were implemented for Client scenario and after (bigger) re-factoring re-used for Server data conversions. The step 2), one-liner JS function call at line 183, is also implemented, leading to legitimate question, with all functions in place what is actually missing? ABAP RFC call comes from external system, registered by node-rfc server and the handler section with commented code is invoked. ABAP system is external independent system from NodeJS perspective and ABAP RFC call is registered in a separate thread. All works fine, as long the handler does not touch JS data. With these handler steps un-commented the exception is raised because any JS access data must be synchronised with v8 event loop. The contribution could help with adding the synchronisation, following: I would be glad to help with more info, exchange or test env configuration. |
Dear @samuel-c-allan, why would you need to use RFC for calling a JS functionality instead of using the ABAP HTTP Client to call a HTTP Endpoint implemented with NodeJS? Best regards |
@gregorwolf This would be a good solution but unfortunately we have to work with very old systems which do not support the http client (namely 4.6c), plus I am happy for an opportunity to contribute to a project I use so extensively :) |
@bsrdjan Thank you for the awesomely detailed descriptions, I will thoroughly inspect all the code and the thread safe call example and get back with any questions / suggestions / whatever I find. I am very excited to be able to work on this part of node-rfc and further my understanding of V8 in the process. |
Just out of curiosity: The extended support for SAP R/3 4.6C ended 31.03.2013. So how is that system supported to run in a productive environment? |
Very valid question. Our product is intended to extract information from these older systems in order to help take them offline and you would be surprised how many people actually use these systems for better or for worse.I am sorry if I can't really explain it properly, I am just uncertain to what extent I am permitted to reveal the functionality at this stage (obviously later on the entire framework will be known).
|
Interresting. But woudn't an extraction on DB level be easier to acomplish? |
Depends on what you mean with a db level extraction. If you mean a non-ABAP mediated extraction, this would possibly work but many of our clients have refused this approach for all sorts of internal reasons like preventing access to sensitive data, etc so at the end of the day that's the real reason (many clients will refuse running even harmless native sql). I myself am frustrated at many of the restrictions imposed that complicate the approach but I think the server method will be the cleanest way of achieving all this and in the worst case it isn't a horrible way of doing it and will certainly work, it is the cleanest of the dirty ways of achieving the result as far as I can see.
|
But in regards to access to sensitive data there is no difference between native SQL and Open SQL in ABAP. Nothing restricts a developer. |
Absolutely. Now try and convince our clients and I will immediately switch to the much more sensible approches :P
As I said, frustrating for someone with knowledge and understanding since I am aware of how much simpler and faster things could potentially be
|
Alright so I read up on all the materials and have this basic plan of action in mind (step by step):
This seems to be the basic idea, as you can probably tell I haven't worked with all of these technologies extensively in the past but if this plan sounds good I will go ahead with step 1 (adapting round_trip). |
It looks good to me. The simulation in step 3 could be eventually avoided and replaced by local RFC server test, using node-rfc client to call node-rfc server. From node-rfc server perspective there is no difference, it anyway does not "see" if ABAP or node client is on another side of RFC connection. The setup was not possible at the time when I was working on this but with WebSockets RFC support added in NWRFC SDK PL6 the local test should be possible. Will check that. Reading about the extraction scenario, would it be easier to use the RFC client to pull the data from ABAP system? Extraction using node-rfc server looks like more efforts to me because of (custom?) ABAP reports required to to extract and push the data to node? But if already existing reports can be consumed then it is of course easier. |
That is the model we have been using so far and there are a few reasons I want to switch (mostly a very particular performance problem with large tables). Basically just trust me it isn't an XY problem 😄 Also, quick update regarding the whole thing - I have run a preliminary test of all the concepts and all appears to be working so hopefully within a day I will be able to link a testing branch which accomplishes the connection |
P.S. Just in case, this page was immensely useful: https://nodejs.org/dist/latest-v11.x/docs/api/n-api.html#n_api_asynchronous_thread_safe_function_calls |
Alright so I think I finally have everything laid out in my head. As I was working on this I realized this needs to handle the important case of several requests pouring in at the same time faster than the execution time of the JS callback. I think however that if my understanding of the First of all, when the server is being started (as far as I understand this happens in the native thread), a thread safe function and context are created and stored somewhere in the server class (as properties). Then, when
Now the obvious question this begs is how does JS signal that the Since JS can't really be expected to do the signalling directly (obviously) this probably means some function needs to be exposed to It seems to me this is a complete solution. Let me know what you think of this and I will begin implementing it shortly [1] this is to allow several genericHandlers on separate threads to all call and wait for their own calls to the callback to complete |
Quick update - I made the callback respond successfully. Now making sure all the memory is managed properly and modifying the architecture slightly to be a bit cleaner |
Update - requests are now fully functional and the thread-safe javascript callback is called successfully. Return values from javascript are currently ignored (so JS->ABAP serialization is not happening at the moment, but this is an easy fix once you confirmed everything works). Please check out a comparison with the testing branch here. Category 1: Changes to the existing codebase
Category 2: New stuff
Testing!!!So, I have only currently tested this with the following setup: I manually compile a
After testing you should get the following (pretty messy) output:
So all of this is very raw, but I would be glad if you could look over it / test it and then we can move onto the next stage which would completing the cycle with JS->ABAP serialization and changing any type/variable names or other stuff to your liking. |
Also - there are some places with questionable memory management, bare with me I am fixing these |
Good and fast progress, many thanks for the update! Will do my best to have a look this week. Could you please also sign the Contribution Agreement, if not already done: https://github.com/SAP/node-rfc#contributing |
Quick unrelated question (it is a bit too simple for me to raise a separate issue so asking here) - there is an annoying feature that when I use a |
(I mean is there a simple way to disable trace files. I did try |
Nvm I had stupid settings in SM59. Apologies |
I have finished it and cleaned up the code. There are still gaps in server support mostly when it comes to stopping the server ( |
P.S. I played around with some of your methods and forgot to revert the changes, I will be reverting those shortly but the rest should be enough to give you an idea |
Also, important: When the JS callback is called from I really needed it to be possible to call this function later for my own purposes and wasn't sure what way would best fit with the philosophies of the library. I did my best, let me know if anything needs to change. |
@bsrdjan Also if you do get to testing I might as well update the test code for you because the one I linked before is now out of date. Here it is:
|
Hi - apologies for all the excessive notifications. I have made some more changes to the API so in order not to have to summarize all here I have simply updated Looking forward to feedback. |
I have synced smarterpsoft/node-rfc master with SAP/node-rfc master (with changes in the testing branch integrated). |
@bsrdjan If you can, please let me know what the status is on this right now. Are you interested in this integration or not? |
Sorry for the delayed response, I am on vacation and can have a look earliest the end of next week. |
What happens when the server disconnects? |
I also did not get the latest status from @samuel-c-allan, not sure if he made the progress here, complete the implementation or faced some issue. I don't have a capacity atm for implementing the feature. |
Dear @bsrdjan, my apologies for responding so late to this.
I worked on the server when the company I work for needed it as part of a tool we were building (we have since switched to using nwrfc directly from C).
Unfortunately as a result of some decisions made by management it is impossible for me to share that code, although if that restriction ever gets cleared I would be very happy to upload it (and I will try and see whether it still applies or not this week).
…________________________________
From: Srdjan Boskovic ***@***.***>
Sent: Thursday, September 29, 2022 7:56 AM
To: SAP/node-rfc ***@***.***>
Cc: Samuel Allan ***@***.***>; Mention ***@***.***>
Subject: Re: [SAP/node-rfc] Status of server support (#209)
I also did not get the latest status from @samuel-c-allan<https://github.com/samuel-c-allan>, not sure if he made the progress here, complete the implementation or faced some issue. I don't have a capacity atm for implementing the feature.
—
Reply to this email directly, view it on GitHub<#209 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ATHKTJIA2I2IF322RFF4EKTWAV7XDANCNFSM426UT6KQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This issue is mostly a question but also a comment on documentation.
The team I work with desperately needs server support in our application (which is currently heavy on use of node-rfc) but I am currently finding it very hard to tell if (and to what extent) ABAP-to-JS calling is supported as the README is very unclear about this.
Inspection of
Server.cc
and some tests with the example experimental code have led me to believe that the basic connectivity is supported but the JS callback has not yet been implemented (in fact there is some commented out code inServer.cc
that seems to be intended to support this).Due to the urgency of our requirement I will certainly be implementing the missing functions in C++, but if the opportunity allows I would greatly wish to contribute to work on the server functionality or in the case that it is already implemented and I am misusing it, to understand what is going wrong. Except the following prevents this (and this is the main complaint of my issue): It is very much unclear from the README where the current work on the server stands, what is supported and what is up for contribution (there is a months old
server
branch which also raises more questions than it answers.Looking forward to any clarification on the matter and again, I would certainly be willing to contribute to this.
The text was updated successfully, but these errors were encountered: