How to restore connection if an error occurs when using ledgerClient.getTransactionsClient()

You might want to have a look at this answer. Furthermore, the RxJava documentation is a great place to find answers specific to the library, including error handling (here).

In the case of the code you shared, which I’m re-writing here for readability (I definitely recommend using the code block feature to show code with indentation):

ledgerClient.getTransactionsClient().
  getTransactions(offsetBegin, filtersByParty, true).
  subscribe(t → {
    String wageringPoolOffset = t.getOffset();
    t.getEvents().forEach(event → {
    someFunction(event,wageringPoolOffset );
  });
});

the error callbacks can be added to the Observable returned by getTransactions by calling for example the onErrorResumeNext on it (but of course do use the error handling operator that makes more sense for you).