{"id":28402397,"url":"https://github.com/reactivex/rxapachehttp","last_synced_at":"2025-06-26T16:32:25.372Z","repository":{"id":19834593,"uuid":"23095956","full_name":"ReactiveX/RxApacheHttp","owner":"ReactiveX","description":"RxJava bindings for Apache HTTP","archived":false,"fork":false,"pushed_at":"2016-09-02T17:34:36.000Z","size":494,"stargazers_count":118,"open_issues_count":8,"forks_count":30,"subscribers_count":17,"default_branch":"0.x","last_synced_at":"2025-06-01T23:47:55.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReactiveX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-19T03:46:49.000Z","updated_at":"2024-03-21T17:37:38.000Z","dependencies_parsed_at":"2022-08-25T23:30:34.575Z","dependency_job_id":null,"html_url":"https://github.com/ReactiveX/RxApacheHttp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ReactiveX/RxApacheHttp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReactiveX%2FRxApacheHttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReactiveX%2FRxApacheHttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReactiveX%2FRxApacheHttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReactiveX%2FRxApacheHttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReactiveX","download_url":"https://codeload.github.com/ReactiveX/RxApacheHttp/tar.gz/refs/heads/0.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReactiveX%2FRxApacheHttp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262102495,"owners_count":23259270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-01T15:37:49.147Z","updated_at":"2025-06-26T16:32:25.363Z","avatar_url":"https://github.com/ReactiveX.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rxjava-apache-http\n\nObservable API for Apache [HttpAsyncClient](http://hc.apache.org/httpcomponents-asyncclient-dev/)\n\nIt is aware of Content-Type `text/event-stream` and will stream each event via `Observer.onNext`.\n\nOther Content-Types will be returned as a single call to `Observer.onNext`.\n\nMain Classes:\n\n- [ObservableHttp](https://github.com/Netflix/RxJava/blob/master/rxjava-contrib/rxjava-apache-http/src/main/java/rx/apache/http/ObservableHttp.java)\n- [ObservableHttpResponse](https://github.com/Netflix/RxJava/blob/master/rxjava-contrib/rxjava-apache-http/src/main/java/rx/apache/http/ObservableHttpResponse.java)\n\n\n# Binaries\n\nBinaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ccom.netflix.rxjava).\n\nExample for [Maven](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22rxjava-apache-http%22):\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.netflix.rxjava\u003c/groupId\u003e\n    \u003cartifactId\u003erxjava-apache-http\u003c/artifactId\u003e\n    \u003cversion\u003ex.y.z\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nand for Ivy:\n\n```xml\n\u003cdependency org=\"com.netflix.rxjava\" name=\"rxjava-apache-http\" rev=\"x.y.z\" /\u003e\n```\n\n# Sample Usage\n\n### Create a Request\n\n```java\nObservableHttp.createGet(\"http://www.wikipedia.com\", httpClient).toObservable();\nObservableHttp.createRequest(HttpAsyncMethods.createGet(\"http://www.wikipedia.com\"), httpClient).toObservable();\n```\n\n### Http Client\n\nA basic default client:\n\n```java\nCloseableHttpAsyncClient httpClient = HttpAsyncClients.createDefault();\n```\n\nor a custom client with configuration options:\n\n```java\nfinal RequestConfig requestConfig = RequestConfig.custom()\n        .setSocketTimeout(3000)\n        .setConnectTimeout(500).build();\nfinal CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom()\n        .setDefaultRequestConfig(requestConfig)\n        .setMaxConnPerRoute(20)\n        .setMaxConnTotal(50)\n        .build();\n```\n\n### Normal Http GET\n\nExecute a request and transform the `byte[]` reponse to a `String`:\n\n```groovy\n        ObservableHttp.createRequest(HttpAsyncMethods.createGet(\"http://www.wikipedia.com\"), client)\n        .toObservable()\n        .flatMap({ ObservableHttpResponse response -\u003e\n                return response.getContent().map({ byte[] bb -\u003e\n                        return new String(bb);\n                });\n        })\n        .toBlockingObservable()\n        .forEach({ String resp -\u003e \n                // this will be invoked once with the response\n                println(resp);\n        });\n```\n\n### Streaming Http GET with [Server-Sent Events (text/event-stream)](http://www.w3.org/TR/eventsource/) Response\n\nExecute a request and transform the `byte[]` response of each event to a `String`:\n\n```groovy\n        ObservableHttp.createRequest(HttpAsyncMethods.createGet(\"http://hostname/event.stream\"), client)\n        .toObservable()\n        .flatMap({ ObservableHttpResponse response -\u003e\n                return response.getContent().map({ byte[] bb -\u003e\n                        return new String(bb);\n                });\n        })\n        .toBlockingObservable()\n        .forEach({ String resp -\u003e \n                // this will be invoked for each event\n                println(resp);\n        });\n```\n\nAn example event-stream is from [Hystrix](https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-metrics-event-stream) used for streaming metrics. An [example webapp](https://github.com/Netflix/Hystrix/tree/master/hystrix-examples-webapp) can be used to test.\n\nOutput looks like:\n\n```\ndata: {\"type\":\"HystrixCommand\",\"name\":\"CreditCardCommand\",\"group\":\"CreditCard\",\"currentTime\":1379823924934,\"isCircuitBreakerOpen\":false,\"errorPercentage\":0,\"errorCount\":0,\"requestCount\":0,\"rollingCountCollapsedRequests\":0,\"rollingCountExceptionsThrown\":0,\"rollingCountFailure\":0,\"rollingCountFallbackFailure\":0,\"rollingCountFallbackRejection\":0,\"rollingCountFallbackSuccess\":0,\"rollingCountResponsesFromCache\":0,\"rollingCountSemaphoreRejected\":0,\"rollingCountShortCircuited\":0,\"rollingCountSuccess\":0,\"rollingCountThreadPoolRejected\":0,\"rollingCountTimeout\":0,\"currentConcurrentExecutionCount\":0,\"latencyExecute_mean\":0,\"latencyExecute\":{\"0\":0,\"25\":0,\"50\":0,\"75\":0,\"90\":0,\"95\":0,\"99\":0,\"99.5\":0,\"100\":0},\"latencyTotal_mean\":0,\"latencyTotal\":{\"0\":0,\"25\":0,\"50\":0,\"75\":0,\"90\":0,\"95\":0,\"99\":0,\"99.5\":0,\"100\":0},\"propertyValue_circuitBreakerRequestVolumeThreshold\":20,\"propertyValue_circuitBreakerSleepWindowInMilliseconds\":5000,\"propertyValue_circuitBreakerErrorThresholdPercentage\":50,\"propertyValue_circuitBreakerForceOpen\":false,\"propertyValue_circuitBreakerForceClosed\":false,\"propertyValue_circuitBreakerEnabled\":true,\"propertyValue_executionIsolationStrategy\":\"THREAD\",\"propertyValue_executionIsolationThreadTimeoutInMilliseconds\":3000,\"propertyValue_executionIsolationThreadInterruptOnTimeout\":true,\"propertyValue_executionIsolationThreadPoolKeyOverride\":null,\"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests\":10,\"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests\":10,\"propertyValue_metricsRollingStatisticalWindowInMilliseconds\":10000,\"propertyValue_requestCacheEnabled\":true,\"propertyValue_requestLogEnabled\":true,\"reportingHosts\":1}\ndata: {\"type\":\"HystrixCommand\",\"name\":\"GetPaymentInformationCommand\",\"group\":\"PaymentInformation\",\"currentTime\":1379823924934,\"isCircuitBreakerOpen\":false,\"errorPercentage\":0,\"errorCount\":0,\"requestCount\":0,\"rollingCountCollapsedRequests\":0,\"rollingCountExceptionsThrown\":0,\"rollingCountFailure\":0,\"rollingCountFallbackFailure\":0,\"rollingCountFallbackRejection\":0,\"rollingCountFallbackSuccess\":0,\"rollingCountResponsesFromCache\":0,\"rollingCountSemaphoreRejected\":0,\"rollingCountShortCircuited\":0,\"rollingCountSuccess\":0,\"rollingCountThreadPoolRejected\":0,\"rollingCountTimeout\":0,\"currentConcurrentExecutionCount\":0,\"latencyExecute_mean\":0,\"latencyExecute\":{\"0\":0,\"25\":0,\"50\":0,\"75\":0,\"90\":0,\"95\":0,\"99\":0,\"99.5\":0,\"100\":0},\"latencyTotal_mean\":0,\"latencyTotal\":{\"0\":0,\"25\":0,\"50\":0,\"75\":0,\"90\":0,\"95\":0,\"99\":0,\"99.5\":0,\"100\":0},\"propertyValue_circuitBreakerRequestVolumeThreshold\":20,\"propertyValue_circuitBreakerSleepWindowInMilliseconds\":5000,\"propertyValue_circuitBreakerErrorThresholdPercentage\":50,\"propertyValue_circuitBreakerForceOpen\":false,\"propertyValue_circuitBreakerForceClosed\":false,\"propertyValue_circuitBreakerEnabled\":true,\"propertyValue_executionIsolationStrategy\":\"THREAD\",\"propertyValue_executionIsolationThreadTimeoutInMilliseconds\":1000,\"propertyValue_executionIsolationThreadInterruptOnTimeout\":true,\"propertyValue_executionIsolationThreadPoolKeyOverride\":null,\"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests\":10,\"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests\":10,\"propertyValue_metricsRollingStatisticalWindowInMilliseconds\":10000,\"propertyValue_requestCacheEnabled\":true,\"propertyValue_requestLogEnabled\":true,\"reportingHosts\":1}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactivex%2Frxapachehttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactivex%2Frxapachehttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactivex%2Frxapachehttp/lists"}