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

Function main

cpp/examples/service_bus.cpp:298–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296
297
298int main(int argc, char **argv) {
299 std::string sb_namespace; // i.e. "foo.servicebus.windows.net"
300 std::string sb_key_name; // shared access key name for entity (AKA "Policy Name")
301 std::string sb_key; // shared access key
302 std::string sb_entity; // AKA the service bus queue. Must enable
303 // sessions on it for this example.
304
305 example::options opts(argc, argv);
306 opts.add_value(sb_namespace, 'n', "namespace", "Service Bus full namespace", "NAMESPACE");
307 opts.add_value(sb_key_name, 'p', "policy", "policy name that specifies access rights (key name)", "POLICY");
308 opts.add_value(sb_key, 'k', "key", "secret key for the policy", "key");
309 opts.add_value(sb_entity, 'e', "entity", "entity path (queue name)", "ENTITY");
310
311 try {
312 opts.parse();
313 check_arg(sb_namespace, "namespace");
314 check_arg(sb_key_name, "policy");
315 check_arg(sb_key, "key");
316 check_arg(sb_entity, "entity");
317 std::string connection_string("amqps://" + sb_namespace);
318
319 sequence seq(connection_string, sb_entity,
320 connection_options()
321 .user(sb_key_name)
322 .password(sb_key)
323 .sasl_allowed_mechs("PLAIN"));
324 proton::container(seq).run();
325 return 0;
326 } catch (const std::exception& e) {
327 std::cerr << e.what() << std::endl;
328 }
329
330 return 1;
331}

Callers

nothing calls this directly

Calls 9

check_argFunction · 0.85
add_valueMethod · 0.80
connection_optionsClass · 0.50
containerClass · 0.50
parseMethod · 0.45
passwordMethod · 0.45
userMethod · 0.45
runMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected