How to pass message from AO callback to client side page

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

How to pass message from AO callback to client side page

Post by dqrest » Tue 11 Jan 2022 10:37

I have asp.net web form application and use Advanced Queuing Technology with the following code:

Code: Select all

protected void Page_Load(object sender, EventArgs e)
{
    var resp = this.Response;
    var msgCallback = new Action<object, OracleQueueMessageEventArgs>((ss, ee) =>
    {
        // How to pass "Hello" to client side?
    	resp.Write("Hello");    	
    });
    var orc = new OracleQueueMessageEventHandler(msgCallback);

    // follow the example https://www.devart.com/dotconnect/oracle/docs/aq.html        
    
    OracleQueue oracleDequeueBob = new OracleQueue("MESSAGE_QUEUE", Entry.Connection);
    oracleDequeueBob.DequeueOptions.Navigation = OracleQueueNavigation.FirstMessage;
    oracleDequeueBob.DequeueOptions.ConsumerName = UserName;
    oracleDequeueBob.AsyncNotification = true;
    oracleDequeueBob.OnMessage += orc;          
}

[WebMethod]
public static void UpdateChat(string text)
{
    var oracleEnqueueQueue = new OracleQueue("MESSAGE_QUEUE", Entry.Connection);
    OracleQueueMessage message2 = new OracleQueueMessage();
    message2.StringPayload = text;
    oracleEnqueueQueue.Enqueue(message2);
}      ​
In the client side I call page method UpdateChat to pass a text to other users.
The function msgCallback is called, but I can not to pass "Hello" to client side because the current HttpContext is lost.
How I can pass some text from server side (C#) to client side?

dqrest
Posts: 32
Joined: Tue 15 Sep 2015 06:01

Re: How to pass message from AO callback to client side page

Post by dqrest » Wed 12 Jan 2022 08:07

I found out that it is used SignalR to pass these messages.

DmitryGm
Devart Team
Posts: 152
Joined: Fri 11 Dec 2020 10:27

Re: How to pass message from AO callback to client side page

Post by DmitryGm » Wed 19 Jan 2022 15:55

The question about the lifecycle of HttpContext exceeds the goals of our support. Perhaps you managed to solve the problem using SignalR? If we misunderstood, please clarify your request regarding the functionality of dotConnect for Oracle.

Post Reply