Comments (2)
I am not sure if I understand correctly but if you are trying to implement logic in which the publisher and handler run in the same thread context then this is hard to do with async messages. Definitely requires custom synchronization logic. One direction would be to provide Mbassador with the ThreadFactory
for the async handlers and implement it in such a way that the handler has access to it. However, this smells like bad design. Can you elaborate your use case a bit more? Maybe there is a better way to achieve what you have in mind.
from mbassador.
Hi Benjamin and thanks for taking care (with my apologies for the late reply due to heavy work load)
The problem is that I'm bound to some framework. I start my servlet with a Callable/Runnable like this:
class myClass {
// this is my framework call . I have to stick with this.
Future <?> myfuture = Application.getContext()-> ()
// now herein I'm happy within my framework and can do what I need
});
// but it stops here
@Handler
public void MyHandler ( ...) {
// here I'm outside and I have no access to the framework
}
} // end class
What I want:
class MyClass {
public void MyClass() {
Future <?> myfuture = Application.getContext()-> ()
@Handler
public void refresh ( final GUIUpdates msg) {
}
});
}
OR:
class MyClass {
public void MyClass() {
Future <?> myfuture = Application.getContext()-> ()
// something like a blocking call
Message m = net.engio.mbassy.WaitForMessage ();
}
});
}
I agree with your remark that the latter is bad design, lets call it ugly.
Problem is that a handler can only be defined on class level.
I will therefore try to remove the lambda call and replace it with a runnable class and try to place the handler there.
If you have some better idea, I would be very happy to hear from you.
Thanks for your work on 'mbassador'.
Gerry
from mbassador.
Related Issues (20)
- Using BusConfiguration throws NullPointerException HOT 2
- Handlers get message only the first time HOT 3
- MBassador depends on ancient mycila-testing-mockito HOT 2
- Failed to build mbassador with maven offline mode for Fedora HOT 4
- [WARNING] Ignoring metadata for artifact pmd:pmd:pom:SYSTEM as it has duplicate metadata HOT 6
- org.fedoraproject.xmvn.tools.install.ArtifactInstallationException: Installation repository is incapable of holding artifact org.mbassy:mbassador-mbassador-1.2.4.2:war:SYSTEM HOT 2
- Shared Message Dispatcher thread pool HOT 1
- there is a way to change the @Handler priority programmatically? HOT 1
- we have to call twice getCause , In IPublicationErrorHandler.handleError(PublicationError )
- Handlers in inner classes not recognized HOT 2
- Don't use dispatcher thread HOT 3
- Lock on handler (or Listener) HOT 7
- IMessageFilter Context? HOT 1
- Explain the supported use cases of generics in message handlers
- Create a project with the interfaces/annotations HOT 4
- How to avoid : "java.lang.reflect.InvocationTargetException There might be an access rights problem. ...'" HOT 1
- Mbussador supports spring transactional? HOT 1
- Potential lambda enhancement
- Build fails using Maven 3.8.3 and JDK 19.0.1 on Arch Linux
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbassador.