Quick Links: |
Provide value-semantic type and utilities for a BlazingMQ queue. More...
bmqt::Uri | value-semantic type representing a URI |
bmqt::UriParser | utility to parse a string into a URI |
bmqt::UriBuilder | builder mechanism to create a URI |
bmqt::Uri
representing a URI for a BlazingMQ queue. A bmqt:Uri
can be built by parsing from a string representation, using the bmqt::UriParser
, or built using the bmqt::UriBuilder
. bmq://ts.trades.myapp/my.queue bmq://ts.trades.myapp.~bt/my.queue bmq://ts.trades.myapp/my.queue?id=foo
[-a-zA-Z0-9\\._]+
). The domain may be[-a-zA-Z0-9_~\\.]+
). The queue name must be less than bmqt::Uri::k_QUEUENAME_MAX_LENGTH
characters long. The URI may contain an optional query with a key-value pair. Currently supported keys are:
initialize
method of the UriParser
. This call is only needed one time; you can call it when your task starts. bmq
library takes care of that, so users of bmq
don't have to explicitly do it themselves. Then, parse a URI string created on the stack to populate a Uri
object. The parse function takes an optional error string which is populated with a short error message if the URI is not formatted correctly. bsl::string input = "bmq://my.domain/queue"; bmqt::Uri uri(allocator); bsl::string errorDescription; int rc = bmqt::UriParser::parse(&uri, &errorDescription, input); if (rc != 0) { BALL_LOG_ERROR << "Invalid URI [error: " << errorDescription << "]"; } assert(rc == 0); assert(error == ""); assert(uri.scheme() == "bmq"); assert(uri.domain() == "my.domain"); assert(uri.queue() == "queue");
Uri
object with a string representation of the URI and an allocator. bmqt::Uri uri("bmq://my.domain/queue", allocator); assert(uri.scheme() == "bmq"); assert(uri.domain() == "my.domain"); assert(uri.queue() == "queue");