Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recieve connections get stale #28

Open
UglyHobbitFeet opened this issue Mar 20, 2020 · 1 comment
Open

Recieve connections get stale #28

UglyHobbitFeet opened this issue Mar 20, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@UglyHobbitFeet
Copy link

UglyHobbitFeet commented Mar 20, 2020

I am using a GraphQL subscription to listen to the AMQP receiver and send back live results as they come in. I notice that the receiver stops sending on an address after some period of time (around 3 mins). If I change the address, the connection works again until some period of time (around 3 mins).

Is there any way to check if a connection is stale and reconnect? Or better yet, a keep-alive flag? Is there something I should be doing differently in the code? Note - I tried both rxJava and non-rxJava versions and they give me the same result.

Example rxJava code is below

import io.vertx.reactivex.amqp.AmqpConnection;

static Publisher<String> receive(AmqpConnection connection, String address) {
  return connection.rxCreateReceiver(address)
      .flatMapPublisher(receiver ->
          receiver.toObservable()
          .doFinally(receiver::rxClose)
	  .doOnError(onError -> onError.printStackTrace())
	  .onErrorResumeNext(throwable -> {
	    throwable.printStackTrace();
	    return Observable.empty();
	   })
  	  .map(amqpMsg -> amqpMsg.bodyAsString())
          .share()
          .toFlowable(BackpressureStrategy.BUFFER));
}  

FWIW I'm on vert.x 3.8.5 for everything

This kinda seems related to #23

@UglyHobbitFeet UglyHobbitFeet added the bug Something isn't working label Mar 20, 2020
@UglyHobbitFeet UglyHobbitFeet changed the title Request connections get stale Recieve connections get stale Mar 20, 2020
@OddsJanttu
Copy link

There are createReceiver methods which take an AmqpClientOptions parameter, IIRC there's a keep-alive option there. Also, receivers can have an exception handler set, perhaps it can be used to detect disconnects?

Honestly, I think the client documentation could and should do a much better job at explaining connection usage and lifecycle, as well as exception handling. 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants