subscribe

Akka HTTP Error Response entity was not subscribed after 1 second

谁说我不能喝 提交于 2021-02-08 05:41:54
问题 I am using Akka HTTP cachedHostConnectionPoolHttps pool to send requests as part of Akka Streams Flow: private val requestFlow: Flow[(HttpRequest, HelperClass), Either[Error, String], _] = Http().cachedHostConnectionPoolHttps(BaseUrl).mapAsync(1) { case (Success(HttpResponse(_, _, entity, _)), _) => Unmarshal(entity).to[String].map(response => { Right(response) }) case (Failure(ex), _) => Future(Left(Error(ex))) } For some reason not all request responses are being processed. Some results in

Akka HTTP Error Response entity was not subscribed after 1 second

谁都会走 提交于 2021-02-08 05:41:35
问题 I am using Akka HTTP cachedHostConnectionPoolHttps pool to send requests as part of Akka Streams Flow: private val requestFlow: Flow[(HttpRequest, HelperClass), Either[Error, String], _] = Http().cachedHostConnectionPoolHttps(BaseUrl).mapAsync(1) { case (Success(HttpResponse(_, _, entity, _)), _) => Unmarshal(entity).to[String].map(response => { Right(response) }) case (Failure(ex), _) => Future(Left(Error(ex))) } For some reason not all request responses are being processed. Some results in

can't seem to use 'first()' on Observable(rxjs in Angular)

空扰寡人 提交于 2021-02-07 08:49:20
问题 I read about this awesome feature in RXJS which would theoretically allow me to subscribe only for one response, but can't seem to implement it. Instead, I'm getting this error, "Property 'first' does not exist on type 'Observable'." although I am just copy-pasting from existing examples. Here's my code: implementHash( token ){ console.log('trying to implement hash', token); const req = this.http.get('http://localhost:3003/token/' + token ); const sub = req //.first() .subscribe( res =>{ sub

can't seem to use 'first()' on Observable(rxjs in Angular)

给你一囗甜甜゛ 提交于 2021-02-07 08:49:16
问题 I read about this awesome feature in RXJS which would theoretically allow me to subscribe only for one response, but can't seem to implement it. Instead, I'm getting this error, "Property 'first' does not exist on type 'Observable'." although I am just copy-pasting from existing examples. Here's my code: implementHash( token ){ console.log('trying to implement hash', token); const req = this.http.get('http://localhost:3003/token/' + token ); const sub = req //.first() .subscribe( res =>{ sub

can't seem to use 'first()' on Observable(rxjs in Angular)

前提是你 提交于 2021-02-07 08:48:08
问题 I read about this awesome feature in RXJS which would theoretically allow me to subscribe only for one response, but can't seem to implement it. Instead, I'm getting this error, "Property 'first' does not exist on type 'Observable'." although I am just copy-pasting from existing examples. Here's my code: implementHash( token ){ console.log('trying to implement hash', token); const req = this.http.get('http://localhost:3003/token/' + token ); const sub = req //.first() .subscribe( res =>{ sub

Angular 6 observables - extract data from .subscribe() function and use it elsewhere

我的未来我决定 提交于 2021-02-07 03:27:51
问题 I'm banging my head against the wall with observables. Almost all of the documentation I can find is in the older rxjs syntax. I have an API call which is an observable. I'm calling it elsewhere and subscribing to it - trying to populate a table with the data from this GET request. If I simply console.log my getData function, it logs the subscription rather than my data. I can successfully console.log data within the .subscribe function, but I want to use data outside of .subscribe() . How do

Angular 6 observables - extract data from .subscribe() function and use it elsewhere

谁说我不能喝 提交于 2021-02-07 03:25:36
问题 I'm banging my head against the wall with observables. Almost all of the documentation I can find is in the older rxjs syntax. I have an API call which is an observable. I'm calling it elsewhere and subscribing to it - trying to populate a table with the data from this GET request. If I simply console.log my getData function, it logs the subscription rather than my data. I can successfully console.log data within the .subscribe function, but I want to use data outside of .subscribe() . How do

Angular 6 observables - extract data from .subscribe() function and use it elsewhere

廉价感情. 提交于 2021-02-07 03:24:21
问题 I'm banging my head against the wall with observables. Almost all of the documentation I can find is in the older rxjs syntax. I have an API call which is an observable. I'm calling it elsewhere and subscribing to it - trying to populate a table with the data from this GET request. If I simply console.log my getData function, it logs the subscription rather than my data. I can successfully console.log data within the .subscribe function, but I want to use data outside of .subscribe() . How do

Angular 10 call finalize() when nested observables complete

拥有回忆 提交于 2021-01-29 18:17:20
问题 finalize nested observables after the last item is processed. Stackblitz finalize() should be called when the observables complete - all the numbers (11, 12, 13) are output. How should the observables be nested? import { from } from "rxjs"; import { map, finalize } from "rxjs/operators"; //emit (1,2,3) const data = [ { userId: 1, id: 1 }, { userId: 1, id: 2 }, { userId: 1, id: 3 } ]; const source = from(data); //add 10 to each value const example = source.pipe(map(val => add(val.id))); /

Return value from subscribe in Ionic

南笙酒味 提交于 2021-01-29 10:11:56
问题 So I want to return a value from a subscribe function like this: async obtenerListadoClases(categoria) { var clasesDB = await this.getClases(categoria) .subscribe((data: any) => { clasesDB = data.clasesDB // **Want to return this** console.log(clasesDB,'clasesDB'); // **Getting Value** }) console.log(clasesDB, 'outside'); // **Not Getting Value** return clasesDB; } Also, I want to use this function in another place like this: var listaClases = await this.claseServicio.obtenerListadoClases