Exemple #1
0
void SendFrame::Process(ConnectionPtr conn)
{
    if (!HeaderExists("destination")) {
        throw ConnectionException("destination header missing.");
    }
    std::string& destination = headers_["destination"];
    if (!conn->IsAllowed(destination, write)) {
        throw ConnectionException("not allowed to send to destination: "+destination);
    }
    struct timeval t;
    gettimeofday(&t, NULL);

    boost::uuids::uuid uuid = boost::uuids::random_generator()();

    headers_["message-id"] = boost::lexical_cast<std::string>(uuid);
    headers_["expires"] = "0";
    headers_["priority"] = "4";
    headers_["timestampmq"] = boost::lexical_cast<std::string>(t.tv_sec);

    conn->server().hub().Send(destination, shared_from_this());
}