qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From surya prakash <asuryaprakash...@gmail.com>
Subject Re: how to set qpid.session.max_ack_delay in cpp
Date Fri, 21 Oct 2011 13:40:39 GMT
I am not using any transactions  i will give  the code which i am using for
publish.

#include <qpid/client/Connection.h>
#include <qpid/client/Session.h>
#include <qpid/client/Message.h>
#include <qpid/client/MessageListener.h>
#include <qpid/client/SubscriptionManager.h>
#include <qpid/client/AsyncSession.h>
#include "qpid/client/QueueOptions.h"
//#include <qpid/client/LocalQueue.h>
#include <cstdlib>
#include <iostream>

#include <sstream>

using namespace qpid::client;
using namespace qpid::framing;

using std::stringstream;
using std::string;

int main(int argc, char** argv) {
    const char* host = argc>1 ? argv[1] : "127.0.0.1";
    int port = argc>2 ? atoi(argv[2]) : 5672;
    Connection connection;
    try {
        connection.open(host, port);
        Session session =  connection.newSession();

        stringstream response_queue;
        response_queue << "request" ;//<< session.getId().getName();

        Message request;
        request.getDeliveryProperties().setRoutingKey("mykey");
        std::cout << "Activating response queue listener for: " <<
response_queue.str() << std::endl;
        string s="Twas brillig, and the slithy toves Did gire and gymble in
the wabe.All mimsy were the borogroves,And the mome raths outgrabe.Twas
brillig, and the slithy toves Did gire and gymble in the wabe.All mimsy were
the borogroves,And the mome raths outgrabe.Twas brillig, and the slithy
toves Did gire and gymble in the wabe.All mimsy were the borogroves,And the
mome raths outgrabe.Twas brillig, and the slithy toves Did gire and gymble
in the wabe.All mimsy were the borogroves,And the mome raths outgrabe.";

        for (int i=0; i<400000; i++) {
                request.setData(s);
                request.getDeliveryProperties().setDeliveryMode(PERSISTENT);
                try{
 sync(session).messageTransfer(arg::content=request,
arg::durable=true,arg::destination="amq.direct");
                }
                catch(const std::exception& error)
                {
                        std::cout<<error.what()<<std::endl;
                }
        }
        connection.close();
        return 0;
    } catch(const std::exception& error) {
        std::cout<<"Surya testing"<<std::endl;
        std::cout << error.what() << std::endl;
    }
    return 1;
}

this is the code which i am using for publish.
On Fri, Oct 21, 2011 at 6:49 PM, Gordon Sim <gsim@redhat.com> wrote:

> On 10/21/2011 12:36 PM, surya prakash wrote:
>
>> I am not using more that 20 bytes of data to test this i got some
>> information like after sending every synchronous message it will default
>> it
>> will sleep for  1000 ms that's why i want to know where to reset that
>> value.
>>
>
> That value is specific to your scenario or system. There is no built in,
> configurable sleep involved here.
>
>
>  in python  qpid.session.max_ack_delay this way we can reset this
>> value. i want this in C++.
>>
>
> I'm not aware of any such option in python. There is such an option in java
> but it affects the consumer, not the producer.
>
>
>  In my system  qpid-perftes: command not found.
>>
>
> Did you build and install qpid yourself? Try under /usr/libexec/qpid/tests.
>
>
>
> ------------------------------**------------------------------**---------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.**apache.org<users-subscribe@qpid.apache.org>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message