Git Product home page Git Product logo

Comments (9)

sbordet avatar sbordet commented on June 5, 2024 1

@dyutiman what you describe is custom application logic that you have to implement yourself.

From the CometD point of view, the messages have been received and they will be processed.
Whether some of them contain an application-specific "event id", CometD cannot know and won't know what it means, so you have to implement your own logic.

from cometd.

dyutiman avatar dyutiman commented on June 5, 2024 1

It seems like working!!

Thank you so much @sbordet

from cometd.

sbordet avatar sbordet commented on June 5, 2024

If the messages have been fully received, they will be processed by CometD.

If you want to stop the processing of already received messages, you can just ignore them, and you do this in your application.

You want to do this on the client or on the server?

from cometd.

dyutiman avatar dyutiman commented on June 5, 2024

I want to do this on the client side.

We keep track of the event id we process and in the next subscription we used the last processed event id to begin. Here as the events are still in process even after we disconnect the client, the next immediate subscription is picking an intermiddiate event id (among those which are being processed).
This is causing duplicate event processing.

from cometd.

dyutiman avatar dyutiman commented on June 5, 2024

Thanks for the reply @sbordet

Yes I agree that it is application specific. I just wanted to check if there is any way available that when I disconnect the client the background Jetty thread which received all the events can be interrupted.

from cometd.

sbordet avatar sbordet commented on June 5, 2024

You can do this with a client extension, something like this:

bayeuxClient.addExtension(new Extension() {
  boolean rcv(ClientSession session, Message.Mutable message) {
    if (bayeuxClient.isDisconnected()) {
      // Drop the message.
      return false;
    }
    return true;
  }
});

from cometd.

dyutiman avatar dyutiman commented on June 5, 2024

This is great. Thanks a lot! Let me try this out and confirm.

from cometd.

sbordet avatar sbordet commented on June 5, 2024

Does it work for you?

from cometd.

dyutiman avatar dyutiman commented on June 5, 2024

I will update here once we try this.

from cometd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.