Page 1 of 1

How to pass message from AO callback to client side page

Posted: Tue 11 Jan 2022 10:37
by dqrest
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?

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

Posted: Wed 12 Jan 2022 08:07
by dqrest
I found out that it is used SignalR to pass these messages.

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

Posted: Wed 19 Jan 2022 15:55
by DmitryGm
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.