Integration of Drupal with c/c++ computational server

foredoc's picture

Hi,

I need to:

1) use drupal-powered web interface to collect user input (parameters);
2) invoke the computational modules/softwares written in c/c++ on a computational server with the parameters collected from the drupal site.
3) return the computational results to the drupal site.

I have been searching on the drupal sites, and I am wondering if Services module fit into my needs. If it is, can anybody give me some hints on how to achieve my goals?

Suggestions are very much appreciated.

Regards,

foredoc

Comments

I don't think the services

tripper54's picture

I don't think the services module is right for this scenario.

The services module creates services for machines to interact with a drupal site. An example would be a mobile phone app that interacts with your drupal database - eg displaying content, authenticating etc.

Here it's the other way around: your drupal site will consume an interface provided by your computational server.

So it depends on what kind of API your computational server provides. You may have to write an API layer for it. While you could use drupal for that, something more lightweight like lumen would make more sense.

On the drupal side you just have to call your computational server API and receive the response.

Thanks, tripper54. On the c++

foredoc's picture

Thanks, tripper54. On the c++ server, I plan to provide complied binaries, and use system calls for the computational jobs. Does it make sense to you?

Regards,

foredoc

I am doing computational work in various ways on my own site

dpatte's picture

www.relativedata.com is a drupal site that does various computation work in C++ and javascript in various ways. The key is using fastcgi in many cases. I can give you more details, of the various methods I use shortly.

On my site, there are three

dpatte's picture

On my Drupal site, there are three c++ apps exposed. They are all handled a different way, but all use iframes and fast-cgi:

World Time zones simply has an iframe src= which immediately calls a fast-cgi app written in c++. The cgi returns the calculated html for the iframe.

Elijah calendar has an iframe src which immediately calls a fast-cgi app written in c++. The cgi returns the html for a form which, whenever submitted, resubmits the data to the fcgi to recalc and redraw the form again with the new information.

Snap Sundial has an html form that is populated using javascript. Submitting the form calls a fcgi which computes the image, which is drawn into the iframe using html with an svg image. The original image is simply a png.

Feel free to look at the page and iframe source - especially any forms on these pages, and if you have any questions - feel free to ask.

Thank you very much, dpatte!

foredoc's picture

Thank you very much, dpatte! I will look into your website as well as your great instructions, and will surely have to pick your mind a little bit more after that.

Again, I appreciate your help and effort on this.

Regards,

foredoc

Hi dpatte, In order to

foredoc's picture

Hi dpatte,

In order to understand your instructions, can you please give me some pointers to iframe and fast-cgi?

Is iframe the drupal module listed in: https://www.drupal.org/project/iframe? And
how about fast-cgai?

Thanks.

Regards,

foredoc

iframe is a stand html

dpatte's picture

iframe is a stand html element type. The module you mention does allow you to put iframes as part of content, though I used javascript/jquery to modify my drupal pages to include the iframe.

fast-cgi, or its slower cousin, cgi, are standards for server-side executables that can be run by apache webservers and maybe other webserver engines such as nginx. My webserver box uses apache.

In another site I developed

dpatte's picture

In another site I developed (proprietary), I am using a separate computation server using 'R'-language to write directly to the drupal data base, then load that data for presentation into the Drupal site. The other server hits drupal service calls to inform the Drupal site whenever new updates have been made to the db, and this is handled using custom Drupal modules.

If you want to reduce

Brian Altenhofel's picture

If you want to reduce coupling between Drupal and the c++ apps, use message queues. Drupal sends the request to Queue A, c++ app consumes instructions from Queue A and sends results to Queue B, Drupal consumes results from Queue B and relays information to the user.

Thank you very much, Brian.

foredoc's picture

Thank you very much, Brian. Does Drupal provide a message queue module? or do I have to write a custom module myself?

I will be great if you can provide me a pointer/instruction on using message queue with Drupal.

Any of your suggestions are very much appreciated!

Regards,

foredoc

RabbitMQ probably has the

Brian Altenhofel's picture

RabbitMQ probably has the most cross-platform support. The Message Broker module supports that. https://www.drupal.org/project/message_broker

Some others to consider:

https://www.drupal.org/project/aws_sqs
https://www.drupal.org/project/openstack_queues

You might also look at the Computing module. https://www.drupal.org/project/computing

Thanks, Brian!I came across

foredoc's picture

Thanks, Brian!

I came across the post as follows, which suggests using Services module for ActiveMQ integration/connection:

http://drupal.stackexchange.com/questions/74206/how-can-i-connect-drupal...

Could you please give me some suggestions on the feasibility of this solution, as well as how it compares to the solutions you suggested earlier?

Thanks again, and I am looking forward to your professional opinion.

Regards,

foredoc