Command Pattern

Command pattern can be extended using RxJava to create a robust application code. This idea is an extension of the NetflixObservableCommand.

Vision Statement

Create a lightweight extensible library that implements a command pattern with RxJava extension. This library should provide an easy way to create commands and turning them into Reactive Observables. Commands will wrap exception handling and provide execution time metric for tracability.

Use Case

In Service-Oriented Programming, it is a common need to combine results of one service execution with the result of another service execution. This is a good fit for the command pattern. However, it would be great to be able to execute services in parallel whenever possible. Creating a reactive application service layer makes a robust and efficient solution for business logic implementation.

Other Solutions

Already mentioned NetflixObservableCommand can be used to implement reactive services.

Why itzap-rxjava

itzaprxjava provides and easy way to turn any executable code into RxJava observable. For example

public Observable<Pair[]> read() { return new RunnableCommand<Pair[]>("cmd-read-flatFile") { @Override protected Pair[] run() { // do some processing return new Pair[0]; } }.toObservable(); }
Code language: PHP (php)

In this example, file processing code is wrapped into RxJava Observable with ease. In addition, itzap-rxjava will provide logging statements that would measure execution time.

Code

Leave a Reply

Your email address will not be published. Required fields are marked *

4 replies
  • jordan 11 says:

    Thanks for every one of your hard work on this blog. My mom take interest in getting into investigation and it’s easy to see why. Most of us learn all regarding the lively way you create both useful and interesting guides via your web blog and as well increase contribution from some others about this idea then our own child is always understanding so much. Take advantage of the remaining portion of the year. You have been doing a tremendous job.

  • My wife and i have been glad when Michael managed to do his inquiry through your precious recommendations he had when using the site. It is now and again perplexing to just be freely giving solutions that some people have been trying to sell. So we realize we’ve got the blog owner to thank for this. These illustrations you made, the easy blog menu, the relationships you can make it easier to create – it’s most great, and it’s helping our son in addition to the family reckon that the situation is thrilling, and that’s highly essential. Many thanks for all the pieces!