event-bus

EventBus/PubSub vs (reactive extensions) RX with respect to code clarity in a single threaded application

跟風遠走 提交于 2020-03-12 06:57:08
问题 Currently, I am using an EventBus/PubSub architecture/pattern with Scala (and JavaFX) to implement a simple note organizing app (sort of like an Evernote client with some added mind mapping functionality) and I have to say that I really like EventBus over the observer pattern. Here are some EventBus libraries : https://code.google.com/p/guava-libraries/wiki/EventBusExplained http://eventbus.org (currently seems to be down) this is the one I am using in my implementation. http://greenrobot

Shared preferences value not updating the second time android

帅比萌擦擦* 提交于 2020-01-07 06:44:13
问题 I have used a Broadcast receiver to change the value of a variable inside my fragment every 24 hours. Since the value of the variable gets reinitialized to previous initialization when the fragment restarts I have used shared preferences to save the value every time so that it does not reinitialize again and again. The problem is that the value is changed once and is not updating again. so if the value is 10 it changes to 11 but then does not go to 12. This is the broadcast receiver public

Akka messaging mechanisms by example

谁都会走 提交于 2019-12-28 11:49:14
问题 I have a fair amount of Apache Camel (routing/mediation/orchestation engine; lightweight ESB) experience and am racking my brain trying to understand the difference between Akka: Dispatchers ( Dispatcher , PinnedDispatcher , CallingThreadDispatcher ) Routers Pools Groups Event Buses According to the docs: Dispatchers are: ...is what makes Akka Actors “tick”, it is the engine of the machine so to speak. But that doesn't really explain what a dispatcher is or what it's relationship to an actor

Is Greenrobot EventBus sticky events order guaranteed?

微笑、不失礼 提交于 2019-12-25 07:39:51
问题 I'm starting using EventBus 3.0.0. I'm having 3 sticky events to be sent from Service to Activity: action started action progress action finished i'm listening to the events on main thread: @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) public void on...Event(... event) { ... } The service sends events in order: started-progressN-..-progressM-finished and the subscribed Activity updates the UI according to the events. After the activity is rotated i expect to get sticky events in the

How to use Event bus library in android

房东的猫 提交于 2019-12-25 04:24:33
问题 I'm try to use event bus lib, I could not understand it's functionality and see multiple examples. Is it use only services class or use activity and fragment then is use activity what situation we use event bus in activity or fragment. 回答1: One of the advantages of events is that you can pass objects around to 'somewhere', and you don't need to know where it is picked up. This makes it easy to push your activity or fragment state to a controller class, and then use events sent from this

javascript event bus architecture

孤者浪人 提交于 2019-12-24 02:33:41
问题 In this video at 20:50 (corresponding slide), Nicholas Zakas presents what I think is an Event Bus architecture. What I don't know is whether the calls that interact with the Bus should be asynchronous or not? The second question: if the calls are asynchronous, how should they be implemented? Thank you 回答1: I believe they are asynchronous indeed. My guess is that way they seem to be implemented is by using custom DOM events . This is a useful technique for decoupling in javascript and you can

Is an event bus unregister necessary

穿精又带淫゛_ 提交于 2019-12-23 16:01:26
问题 I'm implementing MVP pattern in Android and I'm using EventBus to let know the P resenter from activity "A" that something happen at activity "B" to update views from "A". I registered the presenter to EventBus inside in constructor but I don't see any place where I could unregister it. public class PresenterA extends nucleus.presenter.Presenter<ViewA> { public PresenterA() { EventBus.getDefault().register(this); } public void onEvent(ChangesEvent e) { // change views } } Is it necessary to

GWT: How to share a java Object (ie: EventBus) between two modules

喜夏-厌秋 提交于 2019-12-23 05:27:34
问题 I’m building a large application and I would like to split it in several modules like Core Module for initialization, users management, etc…, Customer Module, Production Module, etc… I want to split it in multiples GWT modules (not using GWT splitting technique) and share an EventBus for broadcast some events like LoginEvent, LogoutEvent. I don’t want uses the code splitting technique because I want reduce the compile time and re-compile only the module that I modified. This allow also to

Why do we need event.stopPropagation() in DOM? Is it bad architectural pattern?

放肆的年华 提交于 2019-12-23 03:31:55
问题 In the everyday front-end development I often use DOM as a global event bus that is accessible to every part of my client-side application. But there is one "feature" in it, that can be considered harmful, in my opinion: any listener can prevent propagation of an event emitted via this "bus". So, I'm wondering, when this feature can be helpful. Is it wise to allow one listener to "disable" all the other? What if that listener does not have all information needed to make right decision about

EventBus, register and registerSticky method

懵懂的女人 提交于 2019-12-22 01:45:56
问题 I use greenrobot EventBus library to send data between two fragments in my android app and I want to know what is the diffeence between register(Object b) method and registerSticky(Object object) method? 回答1: EventBus allows you to post events that are "sticky" and by that EventBus understands events that "stick to the eventbus" for future access. If you post a normal event when there are no subscribers registered at the moment of sending, this event will be discarded. You can post a sticky