2
0

NotificationListener.hpp 696 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef NOTIFICATION_LISTENER_HPP
  2. #define NOTIFICATION_LISTENER_HPP
  3. #include <string>
  4. namespace ZeroTier {
  5. /**
  6. * Base class for notification listeners
  7. *
  8. * This class is used to receive notifications from various sources such as Redis, PostgreSQL, etc.
  9. */
  10. class NotificationListener {
  11. public:
  12. NotificationListener() = default;
  13. virtual ~NotificationListener()
  14. {
  15. }
  16. /**
  17. * Called when a notification is received.
  18. *
  19. * Payload should be parsed and passed to the database handler's save method.
  20. *
  21. * @param payload The payload of the notification.
  22. */
  23. virtual bool onNotification(const std::string& payload) = 0;
  24. };
  25. } // namespace ZeroTier
  26. #endif // NOTIFICATION_LISTENER_HPP