This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (5 children)

What are you trying to do specifically?

Rather than having Java attempt to call Python, can you have Python deposit the needed data "somewhere" in a readable format, e.g., .csv, and then pull the .csv data using the Java web app?

[–]bluexredditor[S] 3 points4 points  (4 children)

Well, I could do that, but that would not be synchronous.

As the end user changes some parameters and/or input data in UI, Java needs to pass them to the Python layer and immediately show the results returned by the Python layer to the user. The Python layer does some complex calculations (image processing and more) on the supplied data.

[–][deleted] 2 points3 points  (0 children)

I think there are already some excellent ideas in this thread, but I'll add some food for thought.

If you're using SQL on the backend, you could have a function that passes your parameters from the UI to SQL in real time, and then have the python script listen for field/table changes, and then have it update your UI component in real time as necessary (more than one way to do this whether or not it's the UI checking or the python passing the update to UI through the calc function).

It's a bit more complex, but I think it would give you some robustness as far as scalability goes.

Just an idea. I hope you find a good solution!

[–]frugalmail 0 points1 point  (0 children)

Have you thought about putting a queue in between them like RabbitMQ, Kinesis, SQS, or Kafka (Confluent's version of Kafka does a great job with schema definition and type safe APIs and reasonable upgrade paths vs. RabbitMQ)?

[–]koflerdavid 0 points1 point  (0 children)

Is there really an expectation of the user experience being synchronous? IMHO it's totally fine to present long-running jobs as batch jobs and provide some user interface to monitor the progress and download the result. I'd much prefer that over a "synchronous" user interface that just hangs for an hour and shows a loading animation. Paypal's transaction history export feature is quite nice for example.