question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to use global middleware to stop event processing?

See original GitHub issue

The docs for Global middleware say:

Both global and listener middleware must call next() to pass control of the execution chain to the next middleware.

I’m looking for a way to use global middleware as a type of “event filter”. For example, one use case is checking a list of users that the bot should ignore. Having a way to do this globally (basically, a way to “stop event processing, don’t continue”) would be easier than having to set a flag in the context dict and checking it in every event handler.

Thanks for any insight.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
eddygcommented, Feb 10, 2021

Thank you, Kazuhiro-san, for your time and explanations!

0reactions
seratchcommented, Feb 9, 2021

Sorry, the above comment was initially confusing. I’ve updated it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Middleware - Laravel - The PHP Framework For Web Artisans
The withoutMiddleware method can only remove route middleware and does not apply to global middleware. Middleware Groups. Sometimes you may want to group ......
Read more >
Global Error Handling in ASP.NET Core Web API - Code Maze
In this article, we are going to handle errors by using a try-catch block first and then rewrite our code by using built-in...
Read more >
Complete Guide to Express Middleware - Reflectoring
Middleware functions access the HTTP request and response objects. They either terminate the HTTP request or forward it for further processing ...
Read more >
ASP.NET Core Middleware | Microsoft Learn
Each middleware component in the request pipeline is responsible for invoking the next component in the pipeline or short-circuiting the ...
Read more >
6 Event Processing Samples in Oracle Event Processing
Oracle CQL: Shows how to use the Oracle Event Processing Visualizer Query ... The sample HelloWorld domain is located in /Oracle/Middleware/my_oep/oep/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found