Base solution for your next web application
Open Closed

Notification count is not getting increased when we fire a notification from hangfire #10957


User avatar
0
shedspotter created

What is your product version? 11.0.0

What is your product type (Angular or MVC)? Angular

What is product framework type (.net framework or .net core)? .NET 6

Hi we are trying to send the notification from hangfire jobs, the notification is getting fire properly but the count of the notification which is showing in the bell icon is not getting increased even when we are unable to see those notification in the notication page.

Thanks


5 Answer(s)
  • User Avatar
    0
    sedulen created

    Hi @shedspotter,

    A few questions Is this in production or in a development environment? If you are using Hangfire, does Hangfire run on the same instance as your server-side code? Or do you have Hangfire running on another server?

    Have you changed anything with the Chat or Notification settings, specifically around SignalR?

    If you refresh your browser page, does the bell show the correct notification count?

    Lastly, in your browser, try using Google Chrome, and opening Dev Tools before you login and take any action. Then with your browser open and Chrome DevTools open, trigger the action that should generate the notification for you. If you don't see the Notification, check the Chrome DevTools Console to see if there are any errors reported.

    If you are using everything as it's built in ANZ, and all your server-side code runs on the same server, then it should work. Google Chrome DevTools would show you the signalr connection method (websockets, long polling, server-side events)

    Let me know what you find, -Brian

  • User Avatar
    0
    shedspotter created

    Hi @sedulen, is this in production or in a development environment? => curretly in development If you are using Hangfire, does Hangfire run on the same instance as your server-side code? Or do you have Hangfire running on another server? => it is runnging on same instance but we are using different DB for hangfire

    Have you changed anything with the Chat or Notification settings, specifically around SignalR? => I have not changes anything , the method which I am using is working if we trigger without hangfire job and also increased the count as well

    If you refresh your browser page, does the bell show the correct notification count? => nope

    Lastly, in your browser, try using Google Chrome, and opening Dev Tools before you login and take any action. Then with your browser open and Chrome DevTools open, trigger the action that should generate the notification for you. If you don't see the Notification, check the Chrome DevTools Console to see if there are any errors reported. => nope there is no error

    If you are using everything as it's built in ANZ, and all your server-side code runs on the same server, then it should work => but it is not working we are assuming the same that it need to be work Google Chrome DevTools would show you the signalr connection method (websockets, long polling, server-side events) => yes as I told eariler that the notification is trggering from the hangfire and it showing the toester at bottom right corner but it is not increading the count in bell icon and also it is not showing that notfication in notification page as well so I assume that the notification is getting fired from hang fire but it is not saving in the table where all the notification stores

  • User Avatar
    0
    sedulen created

    Hi @shedspotter,

    got it thank you very mich for answering my questions. That definitely helps narrow down what the issue could be.

    also knowibg that you see the toast message appear helps confirm that your signalr connection in your browser is working correctly.

    I think I have an idea of what might be happening here.

    Is it possible to share the source code of your background job? I understand if its not.

    Mainly what I'm looking for in your background job are:

    • what is the base class you are inheriting from?
    • in your Execute method, are you declaring and completing a UnitOfWork?

    I've experienced an issue similiar to what you are describing and the root cause for me was tjat my Notification is published, but i dont complete my UnitOfWork, so whenvthe Execute function ends, the data i changed gets rolled back and there's nothing in my database tables.

    I hope that's the same issue you are experiencing because it should be a pretty simple fix.

    -Brian

  • User Avatar
    0
    shedspotter created

    Hi @sedulen Thanks for the help you are correct ,I have also doing the same I am not completeing my UnitOfWork after your suggestion I have implemented the completed mentod , and now it is working and count are gettign increased

  • User Avatar
    0
    sedulen created

    Happy to help! I'm glad it was a pretty straight forward fix.