Are KEY_TYPED events consumed by jxbrowser? - jxbrowser

I've added a key listener to a jxbrowser 6.11 BrowserView object to log keys typed by the user. With this listener, I can see keyPressed and keyReleased events, but no keyTyped events. Could jxbrowser be consuming the KEY_TYPED events for some reason? And, if so, is there anything I can do about it? Unfortunately, because of restrictions in the external method being used to process and log the key events, it has to be a KEY_TYPED event passed to it.

KEY_TYPED event is processed properly in BrowserView for Browser instance that was created in LIGHTWEIGHT mode.

Related

Axoniq Event Handler Resuming from offset

I am looking at the AxonIQ framework and have managed to get a test application up and running. But I have a question about how EventHandlers should be treated when using a store that has persistence in the Read Model.
From my (possible naive) understanding. #EventHandler annotated methods in my Projection class get called from the beginning when first launched. This would mechanism seems to assume that the Projection utilises some kind of in volatile store (e.g. an in memory sql like h2) which is re-created from scratch during the application bootup.
However, if the store was persistent in something like Elastic Search, I would want the #EventHandler to resume from its last persisted event instead of from the beginning event.
Is there anyway to control the behaviour of the #EventHandler in this way?
Axon has two types of Event Processors: Subscribing and Tracking.
The Subscribing mode (which was the default up to Axon 3) will handle events in the thread that delivers them. That means you're at "the mercy" of the delivery guarantees of whichever component delivers the events.
The Tracking mode (which is the default since Axon 4 when using an Event Store or otherwise a source that supports it) will have events handled in dedicated threads, managed by the Event Processor itself. That means events are handled asynchronously from the actual publication mechanism.
The Tracking Event Processor uses Tokens to keep track of progress. These Tokens are stored in a TokenStore and updates as the Processor has correctly processed each incoming event (possibly batched). You decide where those tokens are stored. If you update a relational database, we recommend storing the tokens in the same database, so that event changes and tokens are updated atomically.
If you don't specify any TokenStore, it depends on whether you're on Spring Boot, in which case Axon will attempt to detect a suitable TokenStore implementation for you. Otherwise, it may very well just be an in-memory TokenStore, which causes Processors to re-initialize on every startup (and possibly start from the beginning).
To configure a TokenStore
On Spring (Boot), simply add a bean of type TokenStore with the implementation you want to use
When using Axon's Configuration API, on the EventProcessingConfigurer, use one of the registerTokenStore(...) methods.
When the Tracking Processor starts, it will check the Token Store for previous progress, and continue from there automatically.

Different handlers for ejb Timer

I'm trying to set different handlers for different types of tasks created via TimerService , ejb.
I need to figure out a way where I can create a schedule tasks with extra information including the handler type so when a timeout occurs different handlers should be fired according to the timer identification.
Eventually the solution to the problem as i tried to explain is by adding Serialized handler, which is set when you create a timer event.
after you set a handler you can get it from the timer object, so when a timeout occurs we can execute an action according to the relevant handler.

Symfony2 Handler vs Listener what the difference?

I need to create listener or handler to provide some actions for AccessDenied exception.
I've looked some sources of standard handlers and listeners, so looks like they can be use for same task.
I also read this:
What's the difference between Event Listeners & Handlers in Java?
JavaScript - What's the difference between event handlers & listener?
Using Symfony2's AccessDeniedHandlerInterface
But only difference I've seen - that handlers often use for handle exceptions.
So, what the real difference between handler and listener in Symfony ?
Listeners are registered and called when an event occurs. Observer or PubSub patterns are used.
The Handler is more of a strategy pattern that delegates implementation details to class. Which can then be substituted. (composition over inheritance)
The patterns could maybe be interchangeable in some cases, and it's more the intention of the code that calls for one or the other then.

CDI Like Events in ASP.NET

I am primarily a JEE6 developer. I did like to know if there is a way to implement Fire and forget functionality of CDI events in asp.net. and the event observers get to receive a specific data payload with which to respond to the event
Thank you
Sure, you'd have to have a registration object always available so your listeners can register thir interest. Then that same object will have a fire method, or an event object would call that fire method, then you just iterate through the listeners and call their method. Use interfaces to keep it simple.

MVVM Light Listener not releasing / deterministic finalization for registered object?

I have a childwindow with an associated VM that gets created each time I ask the child window to open. when the childwindow opens, it registers a listener for an MVVM Light message. After I close the window, I'm pretty sure that I'm releasing all references to it, but I don't actually call dispose because it does not implement IDisposeable.
When I instanciate another child window of the same type, and send it a different context, I know that I'm receiving the message from the previous instanciation of the VM... each time I use the window, more and more VM are listening, and the code repeats.
How can I be sure that my previous VM that registered to listen to a message, has actually been released and is no longer active. Is there a deterministic way to do this?
Whenever you register a message you should make sure that you unregister the message as well. To unregister you can use Cleanup method on classes deriving from ViewModelBase. In other cases, e.g. a view, you should implement a method hat is called when the view is unloaded - e.g by trapping and handling the unloaded event on a control or view. In this method you then call Messenger.Unregister(EventTarget).
This behaviour is a quirk in the current version of the toolkit, and Laurent is aware of it.
How have you coded the handler for the message in the VM? It sounds like you're probably pointing it to a method inside the same VM which is registering for the message. This causes the Messenger class to maintain a reference to the VM and prevent it's garbage collection (see here for discussion). There are two solutions: implement IDisposable and unregister all messages for your VM instance or simply unregister all messages from the VM instance when the child dialog closes. Personally I'd do both to ensure the entire object web is released.
You can use either the Cleanup method or manually unregister the message. For more details click here.

Resources