LiveThreaded::Resubscribe

Resubscribes only to active subscriptions, removing the original start time, if any. Stored subscriptions and unsubscriptions are replayed in the order they were sent. Usually performed after calling LiveThreaded.Reconnect.

API method
void Resubscribe();
Example usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <databento/exceptions.hpp>
#include <databento/live.hpp>
#include <exception>

using namespace databento;

auto client = LiveThreaded::Builder()
                  .SetKey("$YOUR_API_KEY")
                  .SetDataset("GLBX.MDP3")
                  .BuildThreaded();
client.Subscribe({"CL.c.0"}, Schema::Trades, SType::Continuous);
auto record_callback = [](const databento::Record&) {
  return KeepGoing::Continue;
};
auto exc_callback = [&client](const std::exception& exc) {
  if (dynamic_cast<const TcpError*>(&exc)) {
    client.Resubscribe();
    return LiveThreaded::ExceptionAction::Restart;
  }
  return LiveThreaded::ExceptionAction::Stop;
};
// Ignore metadata
client.Start({}, record_callback, exc_callback);