C++, Max clients exceeded for queue

martinpelak
martinpelak Member Posts: 3
edited November 2021 in PubSub+ Event Broker #1

Hi,

I would like to send Guaranteed messages to a queue and then read them back within a C++ project.

I have managed to create a session (solClient_session_create), then I created a transacted session (solClient_session_createTransactedSession). When creating a flow (solClient_transactedSession_createFlow), I get the following error

  • ReturnCode=Fail
  • SubCode=SOLCLIENT_SUBCODE_MAX_CLIENTS_FOR_QUEUE
  • ResponseCode=503
  • Info=Max clients exceeded for queue
SOLACE_RET_CODE_CHK(solClient_session_createTransactedSession(nullptr, this->m_SolSession, &this->m_transacted_session, nullptr));

solClient_flow_createFuncInfo_t function_info = SOLCLIENT_SESSION_CREATEFUNC_INITIALIZER;
function_info.rxMsgInfo.callback_p = nullptr;
function_info.rxMsgInfo.user_p = nullptr;
function_info.eventInfo.callback_p = common_flow_event_callback;

auto index = 0;
char* flow_properties[10];

flow_properties[index++] = SOLCLIENT_FLOW_PROP_BIND_BLOCKING;
flow_properties[index++] = SOLCLIENT_PROP_ENABLE_VAL;

flow_properties[index++] = SOLCLIENT_FLOW_PROP_BIND_ENTITY_ID;
flow_properties[index++] = SOLCLIENT_FLOW_PROP_BIND_ENTITY_QUEUE;

flow_properties[index++] = SOLCLIENT_FLOW_PROP_BIND_NAME;
flow_properties[index++] = "MY_QUEUE"

flow_properties[index++] = SOLCLIENT_FLOW_PROP_BIND_ENTITY_DURABLE;
flow_properties[index++] = SOLCLIENT_PROP_ENABLE_VAL;

flow_properties[index] = nullptr;

SOLACE_RET_CODE_CHK(solClient_transactedSession_createFlow(flow_properties, this->m_transacted_session, &this->m_flow, &function_info, sizeof(function_info)));

I would like to create one transacted session and flow for a "writer" and the same session and flow for a "reader". Do you happen to know why I get the error?

I have got an access to a web portal where I can configure VPNs and queues.

Thank you, Martin.

Tagged:

Answers

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hi @martinpelak,

    Have you enabled transacted session permissions in your client profile? Have a look in PubSub+ Manager -> -> Access Control -> Client Profiles -> default -> Settings and look for "Use Transacted Sessions".

    Also, please change
    function_info.rxMsgInfo.callback_p = nullptr;
    to something non null. It's where your messages will be received.

  • martinpelak
    martinpelak Member Posts: 3

    Hi,

    Thank you. I enabled it before posting my question. I use solClient_flow_receiveMsg to receive messages.

    Thank you, Martin.

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    OK, good. I assume you've set the Maximum Consumer Count to greater than 0?

    solClient_flow_receiveMsgwill receive messages for your flow (= queue).

    rxMsgInfo.callback_p is for an direct (non-queued) messages. For testing code it's probably fine if you're not subscribing to anything, but please don't go in to prod with that set to null.

  • martinpelak
    martinpelak Member Posts: 3

    Thank you. The Maximum Consumer Count is set to 1000.

    So you suggest that I set rxMsgInfo.callback_p to anything even though I plan on using just solClient_flow_receiveMsg to receive messages? I noticed that in this example, the callback is set to null as well. Would an empty function be ok?

    solClient_rxMsgCallback_returnCode_t rx_message_flow_callback(solClient_opaqueFlow_pt opaque_flow, solClient_opaqueMsg_pt message, void* user)
    {
        return SOLCLIENT_CALLBACK_OK;
    }
    

    I am quite new to Solace so any piece of advice is appreciated.

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hmm. This error is definitely related to the number of connections being exhausted somewhere. Can you check the Message VPN and system maximum connection counts?

    The callback comment is a bit of diversion - I see it as best practice to not have it set to NULL.