Vector send with C++ API

Vector send with C++ API

book

Article ID: KB0090668

calendar_today

Updated On:

Products Versions
TIBCO Rendezvous -
Not Applicable -

Description

Resolution:
Description:
============
The RV C++ API doesn’t provide a method for sending an array of TibrvMsg, but only for sending a single message.

Environment:
===========
ALL


Resolution:
==========
RV C API provides a method for sending a vector of messages.

--------------------------------------------------------

tibrv_status tibrvTransport_Sendv(
    tibrvTransport      transport,
    tibrvMsg*           messageVector,
tibrv_u32           length);
--------------------------------------------------------


You can implement the similar TibrvTransport::Sendv method in C++ API via:

1). Add the method declaration in tibrvcpp.h

virtual TibrvStatus sendv       (TibrvMsg* msgs,tibrv_u32 length);

2). Implement the method by calling the C tibrvTransport_Sendv method, in tibrv_home/src/librvcpp/tport.cpp

TibrvStatus
TibrvTransport::sendv(TibrvMsg* msgs, tibrv_u32 length){
     tibrvMsg* cMsgs = (tibrvMsg*)malloc(sizeof(tibrvMsg) * length);
     for( int i=0;i&ltlength;i++){
         cMsgs[i] = msgs[i].getHandle();
     }
     tibrvTransport_Sendv(_transport,cMsgs,length);
     //TODO return TibrvStatus, and destroy tibrvMsg
}

3). Build the library and link with this customized library for the C++ client application which would like to use the batch send.

4). Make use of the new "sendv" method in the client :

TibrvMsg msgs[2];
const char* subject = argv[i];
msgs[0].setSendSubject(subject);
msgs[1].setSendSubject(subject);
msgs[0].updateString(FIELD_NAME,argv[i]);
msgs[1].updateString(FIELD_NAME,"test");
transport.sendv(msgs,2);

Note that this is just a sample implementation for reference. Customers will need to write their own implementation.

Issue/Introduction

Vector send with C++ API