Hi David,
It's nice to see that this pattern has been formalized, but this isn't
really anything terribly new. I've been using observables to do things
like rollups and other data stream analysis for years now, just not with
this particular package.
Also, note that Futures/Promises don't really compete with Observables.
Futures are good for chaining arbitrary asynchronous events, Observables
for processing streams of homogenous objects. (But is it true that the
Java Future impl is not very useful. I had to develop my own for what i
thought was a very straightforward use case.)
Finally, there is nothing inherently thread safe about Observables (not
that anyone said they were... just saying...). When using the same
Observable instance in a multi-threaded context, you still have to
manage synchonization on your own if the context doesn't somehow do it
for you.
Regards,
m@
On 8/15/2015 11:56 PM, cogmission (David Ray) wrote:
...and Their Use In HTM.java's Network API (NAPI)
Hi Everybody,
I wanted to share a one-page short but very well explained tutorial on
composing asynchronous workflows using RxJava.
Due to the availability of "Big Data", Multicore Processors, Cloud
Computing and emerging concepts of Streaming Workflows; tools like
"Hadoop", "Spark" etc. have come to the forefront as a means of
optimizing concurrency and parallel architectures. Likewise, on a
smaller scale, mastering the tools of Streaming Data utilization is
essential in order to be ready when the future comes visiting upon us.
Enter RxJava...
As you may or may not know, HTM.java's Network API was constructed
using RxJava Observables which are a way of composing units of work in
such a way where they can be used asynchronously or non-asynchronously
without blocking. This also allows you to seamlessly "tie in" the NAPI
in your own applications using chains of Observable items.
Unlike Java "Futures" which only return a single item, RxJava
Observables (which also can use Futures) can return a "streaming" flow
of items in a non-blocking fashion; this allows one to fully utilize
any Threads in use by letting them be continuously active throughout
their life cycle. Better yet, it is very lightweight has no outside
dependencies and can be used with a multitude of languages!!
Netflix, uses RxJava and is its original sponsor and creator. It is a
very exciting new concept that is sweeping the Java developer ranks,
and this is one of the best tutorials on the subject I have found.
http://docs.couchbase.com/developer/java-2.0/observables.html
Enjoy!
David
--
/With kind regards,/
David Ray
Java Solutions Architect
*Cortical.io <http://cortical.io/>*
Sponsor of: HTM.java <https://github.com/numenta/htm.java>
[email protected] <mailto:[email protected]>
http://cortical.io <http://cortical.io/>