Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Kubo Takehiro
RE: Eventmachine compatibility [ reply ]  
2011-06-26 13:57
Ruby-oci8 can theoretically support asynchronous API, except establishing connections, if Oracle provides a new C function which exports a socket handle used for a TNS connection or pipe descriptors for a BEQ connection to a user application.

Though it can, it is hard to do it. It needs throughly refactoring to change the ruby-oci8 base architecture.
It may need another project.

By: Michael Peteuil
RE: Eventmachine compatibility [ reply ]  
2011-06-24 14:18
Hey Kubo,

You're right, the Oracle client C libraries are the limiting factor. Raimonds Simanovskis mentioned this when I spoke to him about it as well, but it totally slipped my mind.

What are the chances of getting Oracle to provide the appropriate C functions in OCI? Probably pretty small.

By: Kubo Takehiro
RE: Eventmachine compatibility [ reply ]  
2011-06-24 12:09
Hi Michael,

Aaron's suggestion will be the only way as far as I can look at the EventMachine code.

Well, ruby-oci8 cannot support asynchronous API because underlying OCI library doesn't provide C functions to make it asynchronous.

By: Michael Peteuil
RE: Eventmachine compatibility [ reply ]  
2011-06-24 02:39
Hey Aaron,

I appreciate the response. While this may work (I have not tested it... yet) I don't think it's ideal. Since EM defer delegates your task to a separate EM thread (not on the main reactor thread) this also means that whatever is being executed through defer should be thread safe (unless I'm mistaken) which could potentially result in a mess. I'd really like to just use the EM deferrable module to use callbacks, but I think the current ruby-oci8 does not support the asynchronous APIs.

Regardless, I will test your suggestion and try to respond back. Thanks again Aaron.

By: Aaron Qian
RE: Eventmachine compatibility [ reply ]  
2011-06-22 23:52
While haven't tested it, I looked into ways to integrate ruby-oci8 with EventMachine. It seems the easiest way is to use EventMachine.defer and some sort of connection pooling on OCI8 to achieve non-blocking. You also need to set OCI8#non_blocking to true when creating your connections.

Again, I haven't tested it yet. If you find this hack works, please let me know.

By: Michael Peteuil
Eventmachine compatibility [ reply ]  
2011-06-19 16:25
Hello,

I was wondering if it would be possible to make the ruby-oci8 library Eventmachine compatible? What do you think would be necessary in order to make this happen?

- Michael