Non-blocking KitchenSink

A

Aaron Becker

I am a recent convert and I am very impressed by the productivity gains
from Ruby.

I would like to basically throw the kitchen sink into the Ruby scripts I
am creating.

I need to use Webrick, SOAP client, SOAP server, DRb, REXML, and Log4r.
However, when I attempt to use the SOAP server and client in the same
script, the SOAP client call blocks the script.

Is it possible to use Webrick, SOAP client, and SOAP server code all in
the same script without blocking? I tried different threads for the
SOAP server and SOAP client, but that did not prevent blocking.

I would like to be able to create daemons respond to SOAP messages and
that are also tiny web servers that allow me to view their logs and near
real-time status from a web page.

Any assistance will be greatly appreciated.

Thanks,

hackdaddy
 
L

Logan Capaldo

--Apple-Mail-18--88582336
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed


Is it possible to use Webrick, SOAP client, and SOAP server code
all in
the same script without blocking? I tried different threads for the
SOAP server and SOAP client, but that did not prevent blocking.

Ruby's threads are in-process any blocking call blocks the whole
process. So I suppose the answer is no. However, what you can try is
using multiple processes and coordinating them with Drb.
--Apple-Mail-18--88582336--
 
A

Aaron Becker

Logan said:
Ruby's threads are in-process any blocking call blocks the whole
process. So I suppose the answer is no. However, what you can try is
using multiple processes and coordinating them with Drb.


Thanks for the reply!

I did manage to get DRb and Webrick working in the same script. I'm
using HTTPServlet::FileHandler to allow the browsing of logs, status,
etc.

This Ruby language is so powerful my immediate temptation is to over
design everything. Well, I guess it's like test driving a new car. I
want to see how far I can push it.

Since I have Webrick already running in a thread, would it be possible
to receive SOAP messages on the same port that it is using for browsing
directories?

Thanks,

hackdaddy
 
R

Robert Klemme

Aaron said:
Thanks for the reply!

I did manage to get DRb and Webrick working in the same script. I'm
using HTTPServlet::FileHandler to allow the browsing of logs, status,
etc.

This Ruby language is so powerful my immediate temptation is to over
design everything. Well, I guess it's like test driving a new car. I
want to see how far I can push it.

Since I have Webrick already running in a thread, would it be possible
to receive SOAP messages on the same port that it is using for
browsing directories?

<disclaimer>Never done this myself with this setup.</disclaimer> Since
Webrick is pretty flexible you should be able to define a request handler
that delegates certain requests to the SOAP handling stuff. The easiest
is probably to define a common prefix for all SOAP requests.

Kind regards

robert
 
E

Eric Hodel

Ruby's threads are in-process any blocking call blocks the whole
process. So I suppose the answer is no. However, what you can try
is using multiple processes and coordinating them with Drb.

Not entirely true. Calls to C code other than socket operations
block the whole process. read and select and accept only block the
thread that calls that method since the core libraries wrap all that
up for you.
 
L

Logan Capaldo

--Apple-Mail-26-238961077
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed


Not entirely true. Calls to C code other than socket operations
block the whole process. read and select and accept only block the
thread that calls that method since the core libraries wrap all
that up for you.

Cool I did not know that.
--Apple-Mail-26-238961077--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top