You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by amir <am...@gmail.com> on 2017/04/21 12:58:15 UTC

[qpid c++ API][AMPQ1.0] Problem with sending little big XML message

Hi
1. I wrote a simple message to read an xml file (around 5kb) and send it
with qpid c++.
It can not send the message for some reason. If I use a short message
(around 1000 byte), it works. On the receiver(broker) there is no problem.
Same is possible with JMS.

2. I would like to know if it is possible to set the message as property as
well !?
//message.getProperties()["data"] = file_contents;
//message.getProperties()["data"].setEncoding("utf8");


int main(int argc, char** argv)
{
    Connection connection;
    try {   
        std::ifstream file("message.xml");
        std::string str;
        std::string file_contents;
        while (std::getline(file, str))
        {
          file_contents += str;
        }  
        const char* url = "IP:Port";
		std::string connectionOptions =
"{transport:'ssl',ssl_ignore_hostname_verification_failure:true,sasl_mechanisms:PLAIN,protocol:amqp1.0,bounds:330000,max_frame_size:1370}";
		Connection connection(url, connectionOptions);
        connection.open();
        Session session = connection.createSession();
        Sender sender = session.createSender("queue");
        qpid::messaging::Message message;
        message.setContentType("text/xml");
        message.setContentBytes(file_contents);
        message.setTtl(qpid::messaging::Duration::SECOND * 10);
    	sender.send(message);
        sender.close();
        session.close();
        connection.close();
        return 0;
    } catch(const std::exception& error) {
        std::cout << "Error: " << error.what() << std::endl;
        connection.close();
    }
    return 1;
}



--
View this message in context: http://qpid.2158936.n2.nabble.com/qpid-c-API-AMPQ1-0-Problem-with-sending-little-big-XML-message-tp7662429.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org