You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

55 regels
1.2 KiB

  1. #pragma once
  2. #include <chrono>
  3. #include <string>
  4. #include <memory>
  5. #include <cppamqp/types.h>
  6. #include <cppamqp/config.h>
  7. #include <cppamqp/connection.h>
  8. #include <cppamqp/channel.inl>
  9. namespace cppamqp
  10. {
  11. const std::string& connection::default_vhost()
  12. {
  13. static const std::string value("/");
  14. return value;
  15. }
  16. const std::string& connection::default_username()
  17. {
  18. static const std::string value("guest");
  19. return value;
  20. }
  21. const std::string& connection::default_password()
  22. {
  23. static const std::string value("guest");
  24. return value;
  25. }
  26. const std::chrono::milliseconds& connection::default_consume_timeout()
  27. {
  28. static const std::chrono::milliseconds value(-1);
  29. return value;
  30. }
  31. connection::operator bool() const
  32. { return static_cast<bool>(_internal); }
  33. amqp_connection_state_t& connection::handle()
  34. {
  35. if (!_internal)
  36. throw exception("connection is closed");
  37. return _internal->connection;
  38. }
  39. const amqp_connection_state_t& connection::handle() const
  40. {
  41. if (!_internal)
  42. throw exception("connection is closed");
  43. return _internal->connection;
  44. }
  45. }