[ 
https://issues.apache.org/jira/browse/PROTON-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16928764#comment-16928764
 ] 

Bajan Fella commented on PROTON-1890:
-------------------------------------

Unfortunately, I will have to copy the code here if I can't attach. In order 
not to pollute the comments I will only copy the lines I added 
{noformat}
#include <proton/source.hpp>
#include <proton/receiver_options.hpp>
#include <proton/source_options.hpp>
#include <proton/ssl.hpp>
#include <proton/transport.hpp>

void setup_filter_map(proton::source::filter_map& my_filter_map, const 
std::string& filter_string)
{
        proton::symbol filter_key("selector");
        proton::value filter_value;
        // The value is a specific AMQP "described type": binary string with 
symbolic descriptor
        proton::codec::encoder enc(filter_value);
        enc << proton::codec::start::described()
                << proton::symbol("apache.org:selector-filter:string")
                << filter_string
                << proton::codec::finish();
        my_filter_map.put(filter_key, filter_value);
}

void on_container_start(proton::container &c) OVERRIDE {
                
                // Stuff I added
                proton::receiver_options ro;
                proton::source::filter_map my_filter_map;
                const auto& clientId = user;
                const std::string filter_string = "(originator <> '" + user + 
"' AND filter = 'N') OR " + user + " = 'Y'";
                setup_filter_map(my_filter_map, filter_string);

                ro.name(user)
                        
.source(proton::source_options().durability_mode(proton::terminus().CONFIGURATION).filters(my_filter_map))
                        .credit_window(1000);

                proton::connection_options co;
        if (!user.empty()) co.user(user);
        if (!password.empty()) co.password(password);

                // suff I added
                co.idle_timeout(proton::duration::MINUTE)
                        
.ssl_client_options(proton::ssl_client_options("lmss:root", 
proton::ssl::verify_mode::VERIFY_PEER))
                        
.sasl_allow_insecure_mechs(true).sasl_allowed_mechs("PLAIN");

        receiver = c.open_receiver(url, ro, co);
    }

        void on_transport_error(proton::transport& transport) override {
                std::cout << "on_transport_error: " << transport.error().name() 
<< " " << transport.error().description();
        }

        void on_transport_close(proton::transport& transport) override {
                std::cout << "on_transport_close: " << transport.error().name() 
<< " " << transport.error().description();
        }{noformat}



> [c++] implement idle_timeout and heartbeats
> -------------------------------------------
>
>                 Key: PROTON-1890
>                 URL: https://issues.apache.org/jira/browse/PROTON-1890
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: cpp-binding
>    Affects Versions: proton-0.16.0
>            Reporter: Praveen Bodke
>            Assignee: Alan Conway
>            Priority: Major
>         Attachments: PROTON-1890.zip, examples.diff
>
>
> This is similar issue reported in PROTON-1782 for ruby. 
> We are facing this issue in cpp binding and i am able to reproduce the issue 
> with scheduled_send_03.cpp example. The test scenario is to drop all the 
> packets from both the interfaces after the successful connection. The only 
> change i made to this example is to send messages continuously inside the 
> send() method. The other end is detecting the error as it is sending the 
> empty frames and no response is heard.
> The proton is not sending the heartbeat messages (empty frames) as the sender 
> is busy in sending the data frames. Is it not necessary to send empty frames 
> even if the data frames are sent?
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to