Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Oracle Advanced Queuing with go-ora #365

Open
robstradling opened this issue May 15, 2023 · 7 comments
Open

Using Oracle Advanced Queuing with go-ora #365

robstradling opened this issue May 15, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@robstradling
Copy link

I'm about to migrate a project (from godror to go-ora) that currently uses godror's NewQueue and Dequeue functions.

Do you have any plans to implement equivalent API functions in go-ora?

(I'm aware that I can already get what I need via PL/SQL, but native go-ora API functions would be really nice :-) ).

@sijms
Copy link
Owner

sijms commented May 16, 2023

I will see code first and inform you

@sijms sijms added the enhancement New feature or request label Jun 18, 2023
@sijms
Copy link
Owner

sijms commented Aug 4, 2023

I make simple implementation for AQ in go-ora/dbms
example found in examples/dbms_aq

please see if it need more modification before release

@robstradling
Copy link
Author

That seems like a good start. Thanks @sijms!

In my projects I use go_ora.NewConnection rather than sql.Open, so it looks like I can't use the functions you've added so far in aq.go. Would you be able to extend the aq.go functions to also support direct use of the package?

godror.Dequeue can dequeue an array of messages (rather than only a single message), similar to DBMS_AQ.DEQUEUE_ARRAY. (Ditto for godror.Enqueue).
Would you be able to provide similar functionality in aq.go?

I make simple implementation for AQ in go-ora/dbms

I suspect that godror (via ODPI and OCI) accesses OracleAQ at a lower level than DBMS_AQ. Just out of interest... Do you think it might be possible to replace the "simple implementation" with code that doesn't rely on PL/SQL? If it's possible, would it be worth doing?

@robstradling
Copy link
Author

In my projects I use go_ora.NewConnection rather than sql.Open, so it looks like I can't use the functions you've added so far in aq.go. Would you be able to extend the aq.go functions to also support direct use of the package?

I've been using go_ora.NewConnection only because the benefit here is that you can use pl/sql and output parameters. However, I noticed that your Dequeue and Enqueue functions in aq.go use pl/sql and output parameters in conjunction with sql.Open. Am I right that there's no longer any advantage to using go_ora.NewConnection instead of sql.Open?

@sijms
Copy link
Owner

sijms commented Aug 12, 2023

sorry I am updating documentation
as the package advance the support for database/sql package increase
until now only feature that is not found in database/sql is query to struct using db tag which require direct package use

@vtolstov
Copy link

Hi! Thank you for such examples, but if i want to get for example 1000 events from AQ process them and if all ok - dequeue it, if something happens - able to read it again from aq?
for example - i';m read 1000 messages from aq and pass it to kafka, if producing successful i'm remove this messsages from aq, if something bad happens - service restarted and re-read again this messages from aq ?

@vtolstov
Copy link

@sijms can you share some info for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants