[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

notify a web-service: sending non-blocking http requests

d c

12/24/2007 12:47:00 PM

hi -

i want to notify a webservice of something, but not wait for the
response. whats the best way to do this?

is there a way to use a GET call to just send a request and then continue?

i could use the timeout library i guess with a timeout of 0 ? which i
guess spawns a thread...

or use
system("curl #{url}")

but this seems like a lot of overhead.

is there a UDP package for ruby?
i guess another hack might be to return a page to the user with a GIF
image with a URL of the service i want to request,
then it will take no resources from my system...
<img width=1 height=1 src='http://server/notify/event" />

tx

/dc

11 Answers

Curt Sampson

12/24/2007 1:33:00 PM

0

On 2007-12-24 21:47 +0900 (Mon), d c wrote:

> i want to notify a webservice of something, but not wait for the
> response. whats the best way to do this?

HTTP doesn't let you do this reliably. The best thing to do is change
the service so that it returns immediately to acknowledge receipt of the
request. Then just use standard Net::HTTP.

> i could use the timeout library i guess with a timeout of 0 ? which i
> guess spawns a thread...

Or just spawn a thread and then have the thread wait for the response.
Be careful, however; Ruby threads are not asynchronous when you're
waiting for IO, unless you're careful to wait in select().

> or use
> system("curl #{url}")

That will wait for the response.

> is there a UDP package for ruby?

Yes, but you can't do HTTP over UDP; you're misunderstanding the protocol.

cjs
--
Curt Sampson <cjs@starling-software.com> +81 90 7737 2974
Mobile sites and software consulting: http://www.starling-so...

Francis Cianfrocca

12/24/2007 5:20:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Dec 24, 2007 7:47 AM, d c <lister@pikkle.com> wrote:

> hi -
>
> i want to notify a webservice of something, but not wait for the
> response. whats the best way to do this?
>
> is there a way to use a GET call to just send a request and then continue?
>


If you're able to use the Ruby/EventMachine library, it solves this problem
easily. Whether you can use it depends on the structure of your program.

The HTTP client inside of EM returns a "Deferrable" object, which
synchronously notifies your program when the HTTP request completes.

yansimon52

11/28/2013 4:31:00 AM

0

Halo Botak...who do u think...which millionaire minister involved in This spying scandal?
Camnot be old man wat?....cos he is too old aldy n he probably spend 95% of his time drinking coffee with his doctors. Same same as wat the late JB..did during his call-up days at CID...oso drinking coffee wit those intelligence police.
LKY is fren wit doctors..vs...JB..was fren wit police.
How abt LHL.?..you think he gave the green light to monitor calls?
I think he did gave the green light cos he is the boss now wat?
Some more hor....his right hand man.."heng chee how"...a minister wit tons of intelligence background behind him..capable of tracing n nabbing 2 top civil servants..tat former cnb chief n civil defence chief....kudos to heng chee how for his good work done.
Maybe Heng is too smart...some sort of a smart alec tat put Sg in a very awkard position.
Maybe Millionaire minister Teo Chee Hean....is the mimister that gave the green light to monitor ph calls?
But this millionaire minister Teo doesnt have another smart alec guy like heng chee how beside him as his right hand man....so very unlikely millionaire Teo is involved.
Maybe Worker Party Low is involved cos as opposition he look forward to put pap reputation into hyflux"s desalination plant..
Maybe wong cunt singh....during his time as millionaire minister .....tat gave the green light..
Now he is laughing all the way to his karaoke session....lol....now its not my biz anymore....cos i am no longer a millionaire minister.

baldeagle

11/28/2013 8:33:00 AM

0

On Thursday, 28 November 2013 12:30:38 UTC+8, yansimon52 wrote:

> Halo Botak...who do u think...which millionaire minister involved in This spying scandal?
>

Hi Simoni....

It was NOT LKY. This happened after his term as the Prime Minister of Singapore. LKY is too smart...certainly not stupid ..to expose Singapore to spy on our neighbours for the USA. Besides, LKY is certainly not spineless to become the pawn of the USA ...against China, Indonesia and Malaysia.

Works on the under water fibre cable in Asia, started in early 90s and completed in 1997...officially commissioned in 1998. The USA must have approached Singapore during this period to participate in the "five eyes" spy ring..

Guess who was the PM during this time. GCT the seat warmer PM served as the PM from 1990 t0 2004.
It must be GCT...whom the US Secretary of State approached. GCT must be the stupid idiot who agreed to spy on Indonesia, Malaysia and China for the USA.

LHL become the PM long after GCT's huge blunder.


However, I suspect that GCT cannot have acted alone...He doesn't have the balls... to give the green light without consulting LHL, his DPM and the Minister of Home Affairs. Lee Hsien Yang was the CEO of SingTel...the party involved in the actual spying work for the USA.


What a bloody mess...a load full of shit ! As a result of this scandal Singapore lost creditability completely with our neighbours. Our position in ASEAN is damaged....

> Camnot be old man wat?....cos he is too old aldy n he probably spend 95% of his time drinking coffee with his doctors. Same same as wat the late JB...did during his call-up days at CID...oso drinking coffee wit those intelligence police.
>
> LKY is fren wit doctors..vs...JB..was fren wit police.
>
> How abt LHL.?..you think he gave the green light to monitor calls?
>
> I think he did gave the green light cos he is the boss now wat?
>
> Some more hor....his right hand man.."heng chee how"...a minister wit tons of intelligence background behind him..capable of tracing n nabbing 2 top civil servants..tat former cnb chief n civil defence chief....kudos to heng chee how for his good work done.
>
> Maybe Heng is too smart...some sort of a smart alec tat put Sg in a very awkard position.
>
> Maybe Millionaire minister Teo Chee Hean....is the mimister that gave the green light to monitor ph calls?
>
> But this millionaire minister Teo doesnt have another smart alec guy like heng chee how beside him as his right hand man....so very unlikely millionaire Teo is involved.
>
> Maybe Worker Party Low is involved cos as opposition he look forward to put pap reputation into hyflux"s desalination plant..
>
> Maybe wong cunt singh....during his time as millionaire minister .....tat gave the green light..
>
> Now he is laughing all the way to his karaoke session....lol....now its not my biz anymore....cos i am no longer a millionaire minister.

auwe digidauw

11/28/2013 9:20:00 AM

0



your singlish is the worst i've seen, terrible !

haiyaaa apa macam ?!

yansimon52

11/28/2013 1:00:00 PM

0

Halo....my english hor..."bor beh chow"...u got standard to write my type of english u know?
U envy me or wat?
U dont play play ...ok?
Sekali i "vee ui vee"...gurmit to come here wit his lamborgini.....then U know....ok?
Halooooo...u "cow son dont know tiger" or wat?

TheInquirer

11/28/2013 1:33:00 PM

0

On 11/28/2013 9:00 PM, yansimon52 wrote:
> Halo....my english hor..."bor beh chow"...u got standard to write my type of english u know?
> U envy me or wat?
> U dont play play ...ok?
> Sekali i "vee ui vee"...gurmit to come here wit his lamborgini


does his lamborgini have "VROOOOM! VROOOOM!"?




......then U know....ok?
> Halooooo...u "cow son dont know tiger" or wat?

auwe digidauw

11/28/2013 4:24:00 PM

0

TheInquirer <always@ask.questions> wrote in news:l77gli$aic$2@dont-
email.me:

>
> does his lamborgini have "VROOOOM! VROOOOM!"?



what you guys singaporeans are talking about ?

I'm lost , totally. Enlighten me please .... :)

pls dont talk cock to me ...

yansimon52

11/28/2013 5:52:00 PM

0

Alamak..u want us to enlighten u......u go buy kopi-o....then we can hv slow talk at kopitiam....ok?

baldeagle

11/30/2013 11:39:00 PM

0

On Friday, 29 November 2013 01:52:17 UTC+8, yansimon52 wrote:

> Alamak..u want us to enlighten u......u go buy kopi-o....then we can hv slow talk at kopitiam....ok?

Hi Simoni...

This people got class...sikit atas. must go eat and drink in food court...not coffee shop. Kopi-O not for them... They drink Star buck...lateeh.
Aiyah...they don't slow talk....It need brain to slow talk. They open mouth big big.... shoot, shoot, and shoot like AK47...vely loud. Sometime, two talk at the same time...just like stereo. Just shoot...no need to brain to think lah. just like computer games...

Simoni.... The Bak Kut Teh seller near Kong Ming Sua just closed shop...rent too much. Now cannot find any good one. Do you know good Bak Kut Teh shop ?