Netflix/Hystrix — pull request #261 by benjchristensen (2014-05-06 00:18:47+00:00)
Title: New signature for HystrixObservableCollapser

Replacing mapResponseToRequests with functional style selectors and allowing streaming response from Observable.

Intent is for a collapser implementation like this:

```java
public class BookmarkCommand extends HystrixObservableCollapser {

private final Video video;

public BookmarkCommand(Video video) {
this.video = video;
}

@Override
public Video getRequestArgument() {
return video;
}

@Override
protected HystrixObservableCommand createCommand(Collection> requests) {
List videos = new ArrayList<>();
for (CollapsedRequest r : requests) {
videos.add(r.getArgument());
}
return new BookmarksCommand(videos);
}

protected void onMissingResponse(CollapsedRequest r) {
// would normally send a default instead of failing here
r.setException(new Exception("No bookmark"));
}

@Override
protected Func1 getBatchReturnTypeKeySelector() {
return new Func1() {

@Override
public Integer call(Bookmark b) {
return b.getVideoId();
}

};
}

@Override
protected Func1 getRequestArgumentKeySelector() {
return new Func1() {

@Override
public Integer call(Video v) {
return v.getId();
}

};
}

@Override
protected Func1 getBatchReturnTypeToResponseTypeMapper() {
return new Func1() {

@Override
public Bookmark call(Bookmark b) {
return b;
}

};
}

}
```