What is the difference between RxJava and Bolts?

I have done research on this, and I know that RXJava uses an observable pattern, and Bolts relies on the performer. What structure will be useful for processing tasks that need to be performed sequentially?

I have heard about using singleExecutors, queues, asynchronous chains, and these two frameworks. I have seen more people using bolts against rxjava, but I am curious to hear about the experiences of people between them.

Thanks!

+5
source share
3 answers

I used both in different projects and made the transition from Bolts to RxJava. A simple answer to your question

What structure will be useful for handling tasks that need to be performed in sequence?

Perhaps you can easily use any framework for this. They are both:

  • Allow task chain one by one
  • Include artist, etc. for every task
  • Allow capture and error handling at a convenient time

However, this is where the functionality of Bolts ends, while RxJava just keeps giving. The real power of RxJava lies in its operators, which, among other things, allow you to convert, combine and filter data.

The learning curve for both frameworks is steep, RxJava is steeper ... but it is much more powerful.

Aside counting method for two libraries

RxJava - 4605 Bolts - 479 
+13
source

Jahnold gave an excellent overview, and I just wanted to add a little more information:

First, both Bolts and RxJava are Java implementations of Microsoft's asynchronous programming models: Bolts = Task Parallelization Library and RxJava = Reactive Extensions. They also make chaining and thread switching very easy (background ↔ main thread).

The best way to compare Bolts / TPL with RxJava / Rx is that bolts are for asynchronous single values ​​(promises), and RxJava is for asynchronous lists of values ​​(streams).

  • So bolts would be good for background work that returns a single value, such as general network requests, reading files from disk, etc. and
  • RxJava will be good for things that return multiple values, such as subscribing to GPS coordinates, onClick events, etc.

So, to better answer your question:

What structure will be useful for handling tasks that need to be performed in sequence?

I would have to ask another: do you pursue that your work is a single result or several results?

+7
source

These two libraries solve two different problems.

Bolts

Bolts simplify asynchronous programming by transparently clicking code on a background thread. Bolts also put a lot of effort in trying to reduce the ugly nesting of the code, which creates the format of a nested pyramid.

Therefore, if you are specifically going to solve problems with asynchronous (multi-threaded), Bolts is working on more reliable solutions. Bolts are also effective for removing the nesting and callback patterns, and this is probably a great solution to easily fix callback problems.

Rxjava

RxJava is specifically designed to support the reactive programming paradigm. Reactive programming is an alternative to imperative Java programming. You can choose the transition to the reactive programming paradigm for various reasons, of which there are many. If you want to port your code to the reactive programming model or want to use reactive in your projects with new projects, consider using RxJava, the de facto reactive standard in the Java world.

Reactive also solves the problem of asynchronous programming, and also reduces the generic callback pattern. But it should not be used only to solve these problems. For example, Bolts' ability to resolve the nested pyramid code structure makes it a more viable solution for asynchronous programming. On the other hand, if you use reactive through RxJava, problems with asynchronous tasks have already been solved, so it makes no sense to actuate the bolts.

0
source

All Articles