qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Godfrey <rob.j.godf...@gmail.com>
Subject Re: Java Broker performance
Date Fri, 10 Nov 2017 09:11:56 GMT
Thanks Tomas,

we'll look into this

-- Rob

On 10 November 2017 at 09:59, Vavricka <vavricka.tomas@gmail.com> wrote:

> C++ client code below
>
> #include <string>
> #include <iostream>
>
> #include <proton/connection_options.hpp>
> #include <proton/container.hpp>
> #include <proton/default_container.hpp>
> #include <proton/message.hpp>
> #include <proton/message_id.hpp>
> #include <proton/messaging_handler.hpp>
> #include <proton/thread_safe.hpp>
> #include <proton/tracker.hpp>
> #include <proton/value.hpp>
>
> class Broadcaster : public proton::messaging_handler
> {
>
>     private:
>
>         std::string _account;
>         std::string _password;
>         std::string _host;
>         unsigned int _port;
>         unsigned int _count;
>         unsigned int _size;
>         unsigned int _sent;
>         unsigned int _confirmed;
>         std::string _exchange;
>         std::string _routingKey;
>         proton::sender _sender;
>
>     public:
>
>     explicit Broadcaster(const std::string &account,
>                          const std::string &password,
>                          const std::string &host,
>                          unsigned int port,
>                          const std::string &exchange,
>                          const std::string &routingKey,
>                          unsigned int count,
>                          unsigned int size)
>         : _account(account)
>         , _password(password)
>         , _host(host)
>         , _port(port)
>         , _count(count)
>         , _size(size)
>         , _sent(0)
>         , _confirmed(0)
>         , _exchange(exchange)
>         , _routingKey(routingKey)
>     {
>     }
>
>     void on_container_start(proton::container &c)
>     {
>         proton::connection_options connectionOptions;
>         connectionOptions.sasl_allow_insecure_mechs(true);
>         connectionOptions.sasl_allowed_mechs("PLAIN");
>         c.client_connection_options(connectionOptions);
>
>         std::string url = "amqp://" + _account + ":" + _password + "@" +
> _host + ":" + std::to_string(_port) + "/" + _exchange;
>
>         _sender = c.open_sender(url);
>     }
>
>     void on_sendable(proton::sender &s)
>     {
>         while (s.credit() && _sent < _count)
>         {
>             proton::message msg;
>             msg.id(_sent + 1);
>             msg.subject(_routingKey);
>             msg.body(std::string(_size, '*'));
>             msg.durable(true);
>             s.send(msg);
>             _sent++;
>             std::cout << "-I sent " << _sent << " of " << _count
<<
> std::endl;
>         }
>     }
>
>     void on_tracker_accept(proton::tracker &t)
>     {
>         _confirmed++;
>         if (_confirmed == _count)
>         {
>             std::cout << "-I- All messages (" << _confirmed << ")
> confirmed"
> << std::endl;
>             t.connection().close();
>         }
>     }
>
>     void on_transport_close(proton::transport &t)
>     {
>         _sent = _confirmed;
>     }
>
>     void run()
>     {
>         try
>         {
>             proton::default_container(*this).run();
>         }
>         catch (const std::exception &error)
>         {
>             std::cerr << "-E- Caught exception: " << error.what() <<
> std::endl;
>             throw error;
>         }
>     }
> };
>
> int main(void)
> {
>     Broadcaster("C7",
>                 "C7",
>                 "pc1wj611",
>                 20001,
>                 "broadcast",
>                 "broadcast.C7_CashTransaction",
>                 1000,
>                 1024).run();
>     return 0;
> }
>
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-
> f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

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