MCPcopy Create free account
hub / github.com/apache/qpid-proton / main

Function main

cpp/examples/simple_send.cpp:95–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93};
94
95int main(int argc, char **argv) {
96 std::string address("127.0.0.1:5672/examples");
97 std::string user;
98 std::string password;
99 bool reconnect = false;
100 int message_count = 100;
101 example::options opts(argc, argv);
102
103 opts.add_value(address, 'a', "address", "connect and send to URL", "URL");
104 opts.add_value(user, 'u', "user", "authenticate as USER", "USER");
105 opts.add_value(password, 'p', "password", "authenticate with PASSWORD", "PASSWORD");
106 opts.add_flag(reconnect, 'r', "reconnect", "reconnect on connection failure");
107 opts.add_value(message_count, 'm', "messages", "send COUNT messages", "COUNT");
108
109 try {
110 opts.parse();
111
112 simple_send send(address, user, password, reconnect, message_count);
113 proton::container(send).run();
114
115 return 0;
116 } catch (const example::bad_option& e) {
117 std::cout << opts << std::endl << e.what() << std::endl;
118 } catch (const std::exception& e) {
119 std::cerr << e.what() << std::endl;
120 }
121
122 return 1;
123}

Callers

nothing calls this directly

Calls 6

add_valueMethod · 0.80
add_flagMethod · 0.80
containerClass · 0.50
parseMethod · 0.45
runMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected