Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

No notifications using Continuous Query Notification (CQN) after some idle time

user3069926Feb 13 2020 — edited Feb 13 2020

Hello,

I am using ODP.NET core to register Continous Query Notification with Oracle Database 12c R2. This works and event handler is called on change , however after some idle time (typically during off business hours when there are no updates), Events/notifications are no longer received and netstat doesnt show port being opened between Database and Application Server. This requires restarting the process (i.e. Windows service) every day. Is their any workaround or resolution for this ?

protected override async Task ExecuteAsync(CancellationToken stoppingToken)

        { 

         

                if(ExecutionFlag)

                {

                        ExecutionFlag = false;

                        _logger.LogInformation("Worker Started at: {0}", DateTimeOffset.Now);

                          

                        OracleConfiguration.DbNotificationPort = 1201;

                        OracleDependency dep = null;

                        OracleConnection con = null;

                        try

                        {

                            con = new OracleConnection(oraConnection);

                            OracleCommand objCommand = new OracleCommand("select * from fins_authorizationmaster", con);                 

                            con.Open();

                            dep = new OracleDependency(objCommand);                           

                            objCommand.AddRowid = true;

                            objCommand.Notification.IsNotifiedOnce = false;

                            dep.OnChange += new OnChangeEventHandler(Worker.dep_OnChange);

                            objCommand.ExecuteNonQuery();

                        }

                        catch (System.Exception ex)

                        {              

                            _logger.LogError("Error on Worker Page -  ExecuteAsync {0}", ex.Message + "|" + ex.InnerException + "|" + ex.StackTrace);                           

                        }                     

                }                 

        }

Comments

Post Details

Added on Feb 13 2020
1 comment
423 views