You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some databases can inform clients when the results of a query have changed. Oracle is an example of one such database, but there are others. Currently utilizing this feature requires manually working with JDBC and giving up the benefits of Micronaut Data.
It would be nice to have an integrated support for this. Behind the scenes using the feature is very simple:
Create a "registration" object using OracleConnection.registerDatabaseChangeNotification(properties) being careful to let the user set the OracleConnection.DCN_CLIENT_INIT_CONNECTION property to true as otherwise the DB will try and dial back the client over TCP when there's a notification - efficient, but not compatible with firewall or NATd networks as found in e.g. containers.
Add one or more listener/callback objects to the registration.
Set the registration object on the OracleStatement or OraclePreparedStatement object.
Do some queries.
You can now close the connections and so on, and the driver will call you back on its own thread when the rows that the queries read have changed.
From an integration perspective, it probably makes sense to allow ordinary query methods to be passed an org.reactivestreams.Subscriber or java.util.concurrent.Flow.Subscriber object. It doesn't make sense to add a new magic name variant like findAllAndWatch because you generally want the results of the query you do in any case. Then:
would work fine as then you can just implement the interface and the onNext method to get a stream of values of the FOO column as it changes for that id. The Subscription object passed to Subscriber.onSubscribe can then be used to cancel the registration.
The text was updated successfully, but these errors were encountered:
Feature description
Some databases can inform clients when the results of a query have changed. Oracle is an example of one such database, but there are others. Currently utilizing this feature requires manually working with JDBC and giving up the benefits of Micronaut Data.
https://docs.oracle.com/en/database/oracle/oracle-database/19/jjdbc/continuos-query-notification.html#GUID-8A2BF5CA-CB76-4D88-B467-4A2AE63D89D4
It would be nice to have an integrated support for this. Behind the scenes using the feature is very simple:
OracleConnection.registerDatabaseChangeNotification(properties)
being careful to let the user set theOracleConnection.DCN_CLIENT_INIT_CONNECTION
property to true as otherwise the DB will try and dial back the client over TCP when there's a notification - efficient, but not compatible with firewall or NATd networks as found in e.g. containers.OracleStatement
orOraclePreparedStatement
object.From an integration perspective, it probably makes sense to allow ordinary query methods to be passed an
org.reactivestreams.Subscriber
orjava.util.concurrent.Flow.Subscriber
object. It doesn't make sense to add a new magic name variant likefindAllAndWatch
because you generally want the results of the query you do in any case. Then:would work fine as then you can just implement the interface and the
onNext
method to get a stream of values of the FOO column as it changes for that id. TheSubscription
object passed toSubscriber.onSubscribe
can then be used to cancel the registration.The text was updated successfully, but these errors were encountered: