How to pass streamId in a batch message.

Is there a way to pass a specific streamId when encoding a message.

In the example we have this:

for(i = 0; i < itemCount_; i++)
{
itemName.data = marketPriceItemInfoList_[i].itemname;
itemName.length = marketPriceItemInfoList_[i].nameLength;
marketPriceItemInfoList_[i].streamId = ++streamId;
if((ret = rsslEncodeArrayEntry(&encodeIter, &itemName, 0)) < RSSL_RET_SUCCESS)
{
printf("rsslEncodeArrayEntry() failed with return code: %d\n", ret);
return ret;
}
}

which is the for loop when sending a batch request. What I was wondering if there is a way when dealing with encoding a batch request to send a specific streamId in rsslEncodeArrayEntry()?

If not how is the streamId determined when the request is finished being processed?

Best Answer

  • nick.zincone
    Answer ✓

    Hi @manning0218,

    The streamID in a batch request is set when setting up the request message.

    RsslRequestMsg msg = RSSL_INIT_REQUEST_MSG;
    ...

    /* set-up message */
    msg.msgBase.msgClass = RSSL_MC_REQUEST;
    msg.msgBase.streamId = streamId;

    However, the streamId associated with the batch request is only used to acknowledge the receipt of the request. When the Provider successfully receives the request, the application will receive a status message indicating the batch was received and will close the stream. It is up to the application, through REFRESH and STATUS messages to determine when the complete batch has been processed.

Answers

  • Hi @manning0218

    Please refer to the ETA developer guide section on Batch Requests ( section 13.7.1 in v3.0.2 of the document)

    As explained the developer specifies a StreamId for the request message and then incremental StreamID are assigned for the items in response.

    image

    In the above figure, the consumer uses streamId 4 to send a batch request for three items, having ensured that streamIds 5,
    6, and 7 are free and not already being used by existing open streams. The server acknowledges the batch request by responding with an RsslStatusMsg on streamId 4,
    and provides the response for each of the three items on streamIds 5, 6, and 7, respectively.

    As explained by Nick above, streamId 4 will be closed off once you have received the status msg.

  • Thank you both for your answers. It makes more sense what is going on with the batch request now.