How do we specify multiple hosts in EMA sdk ?

Options

How do we specify multiple hosts (assuming primary, secondary) for a consumer client ?


Below is the function signature from their header

OmmConsumerConfig& host( const EmaString& host = "localhost:14002" );


It can accept “host:port”, however in our current setup of trep/rfa, we provide 2 hosts, i.e. "host1 host2"


Want to know if there is such provision for Consumer with Ema sdk.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @ryusuke.kamimura

    OmmConsumerConfig::host() is used to specify a hostname and port.

    1659577439559.png

    It doesn't support multiple hosts.

    To use multiple hosts, you need to specify it in the EMA configuration via the ChannelSet configuration. 1659577569477.png

    You can specify this in the EMAConfig.xml. For example:

    <ConsumerGroup>
        <ConsumerList>
             <Consumer>
                   <Name value="Consumer_1"/>
                   <!-- ChannelSet is optional -->
                   <ChannelSet value="Channel_1, Channel_2"/>
                   <!-- Logger is optional: defaulted to "File + Success" -->
                   <Logger value="Logger_1"/>
                   <!-- Dictionary is optional: defaulted to "ChannelDictionary" -->
                   <Dictionary value="Dictionary_1"/>
            </Consumer>
       </ConsumerList>
    </ConsumerGroup>
    ...

    Otherwise, you can use the programmatic configuration feature of EMA, as shown in the 421_MP_ProgrammaticCfg example.

Answers