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

Add initializeListener default method to QueryBatchListener #822

Closed
vivekmuniyandi opened this issue Sep 21, 2017 · 2 comments
Closed

Add initializeListener default method to QueryBatchListener #822

vivekmuniyandi opened this issue Sep 21, 2017 · 2 comments

Comments

@vivekmuniyandi
Copy link
Contributor

Add a default initializeListener(QueryBatcher) method to QueryBatchListener which does nothing. Custom listeners that wants to retry in case of failover exceptions, have to override this method and initialize the RetryListener that facilitates retrying the listeners. The implementation of the method which would help retrying the listener is as follows:

@Override
  public void initializeListener(QueryBatcher queryBatcher) {
    HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener.getInstance(queryBatcher);
    if ( hostAvailabilityListener != null ) {
      BatchFailureListener<QueryBatch> retryListener = hostAvailabilityListener.initializeRetryListener(this);
      if( retryListener != null )  onFailure(retryListener);
    }
  }

and you have to call this method in the processEvent(QueryBatch) method like

initializeListener(batch.getBatcher());
@vivekmuniyandi
Copy link
Contributor Author

This is just a cosmetic change and nothing has changed in the existing functionality.

@srinathgit
Copy link
Contributor

Able to retry other listeners (like ApplyTransform) using initializeListener method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants