Code Monkey home page Code Monkey logo

Comments (4)

zimeg avatar zimeg commented on June 10, 2024

Hey @lz000 πŸ‘‹ Thanks for the interesting question! When setting up an event listener, like app.message, the event is registered to an events dispatcher for your app and I don't believe these events can be deregistered once added.

Replacing an existing event listener with a different one, however, does seem possible by replacing an existing handler with the latest. This applies to most events except for message, which has handlers appended to the list of listeners instead.

I hope this helps but let me know if this is giving you any troubles! I'm also curious if you're trying to re-register certain events or the message one specifically? Some logic within a listener might be another approach to deregister a listener without removing it from the list of event handlers too, but might not be ideal.

from java-slack-sdk.

seratch avatar seratch commented on June 10, 2024

Specifically talking about app.message listener user case, I would recommend having one large app.event(MessageEvent.class) listener and having your own dispatcher within it. This approach offers greater flexibility and eliminates the need to focus on Bolt-specific details.

from java-slack-sdk.

lz000 avatar lz000 commented on June 10, 2024

@seratch thanks. That wouldn't work for our case, because when we want un-register, we don't want the app to get message from slack at all. With your approach, the app still retrieve message but just ignored. We have 2 instances. We want 1 instance retrieve message, they other one unregister so it does not compete message with the first one. We want to make this dynamic, so we can control which instance to register and unregister

from java-slack-sdk.

seratch avatar seratch commented on June 10, 2024

Ah I see. Unfortunately, bolt and the Slack platform do not provide a feature that meets your needs. The only approach I can suggest is to have a proxy server in front of your bolt app instances and let the proxy server do a kind of load balancing like you mentioned.

I understand this is not a great answer for you but we don’t have anything else to share on this matter. If everything is clear to you so far, would you mind closing this issue? You can submit new ones whenever you have new but similar questions.

from java-slack-sdk.

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.