1. jorge gonzalez
  2. PowerBuilder
  3. Thursday, 21 April 2022 17:00 PM UTC

We have a PB application that uses Imagemagick to join one or more tif files into one tif file. We use Ole to connect to imagemagick. Sometimes this process of joining one or more tiff files takes a long long time. Our database or the firewall is setup too close a DB connection after 2 minutes of inactivity. I have no control over this. Will a timer event set to execute before the 2 minutes execute even when Imagemagick is doing its thing of joining files? I want to execute a small query in the timer event before the 2 minutes so I don't lose my connection.

Thanks

Daniel Vivier Accepted Answer Pending Moderation
  1. Thursday, 21 April 2022 20:16 PM UTC
  2. PowerBuilder
  3. # 1

Having read the previous suggestions, why not just disconnect from the DB, do the ImageMagick work, then reconnect to the DB. That way it's under your control, and will work whether it take more or less than 2 minutes. 

Of course there's another possible problem of the entire app appearing to become non-responsive (and gets the dreaded "Application has stopped working" popup) if it takes too long. If that is happening you might need a more complex solution, triggering an external process that messages you back when it is done, as suggested in another response.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 21 April 2022 20:02 PM UTC
  2. PowerBuilder
  3. # 2

Hi Jorge;

   Suggestion: I would break the ImageMagicK processing down into a separate Application EXE and then call this App EXE from the main PB App. Then the main PB App just needs to wait for a "Completed" message from the IM App when the TIF file has been merged. Here is a very successful example architecture that I have used in the past for this type of processing (included OCR plus IMGK)...

FYI: https://sourceforge.net/projects/stdfndclass/files/Presentations/Imaging

  Also, I would use either the TCP/IP or SendMessage() mechanisms to communicate from the "TIF worker" App to the "Main app" to signal that the imaging work has been completed (or failed for whatever reason). For example:

TCP/IP Example: http://chrispollach.blogspot.com/2019/12/socket.html

Send Message Example: http://chrispollach.blogspot.com/2019/11/sendmsg.html

With the above techniques - your main App does not have to stay connected to the DBMS while the Worker App is performing it's TIF concatenation. Only when the main App gets a "Completed" message from the Worker App does it need to connect to the DB again to upload the result.  Food for thought.

Regards ... Chris

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 21 April 2022 19:30 PM UTC
  2. PowerBuilder
  3. # 3

Greetings, Jorge - 

That will very like NOT work, as a PB app has only a single event message queue/handler, unless multithreading is used. If this main thread is busy (doing ImageMagick work, as you indicated), no other events can occur.

You might want to consider creating a RESTful web service to perform the ImageMagick task(s), given the absurdly short inactivity thresholds you must contend with. Multithreading using PB shared objects is also a possibility, but there are limitations as to what kinds of activities can be performed... the biggest limitation that might affect you in this case is there can be no visual/GUI interactions performed in the alternate thread(s).

Regards, John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.