How to establish multiple connections using RFA API

Is it possible for RFA API to establish multiple connections (to a same host but different ports ) ?

i.e.

Destination/publisher host:

Test_Host1

Ports:

- 10101

- 10102

..

- 10108


We have configured like below but it seems it just only connect to one of them :

===================

<?xml version="1.0" encoding="UTF-8"?>

<EmaConfig>

<ConsumerGroup>

<DefaultConsumer value="Consumer_1"/>

<ConsumerList>

<Consumer>

<Name value="Consumer_1"/>

<ChannelSet value="Channel_1, Channel_2"/>

<Logger value="Logger_1"/>

<Dictionary value="Dictionary_1"/>

<XmlTraceToStdout value="0"/>

</Consumer>

</ConsumerList>

</ConsumerGroup>

<ChannelGroup>

<ChannelList>

<Channel>

<Name value="Channel_1"/>

<ChannelType value="ChannelType::RSSL_SOCKET"/>

<CompressionType value="CompressionType::None"/>

<GuaranteedOutputBuffers value="5000"/>

<ConnectionPingTimeout value="30000"/>

<TcpNodelay value="1"/>

<Host value="test_host1"/>

<Port value="10101"/>

</Channel>

<Channel>

<Name value="Channel_2"/>

<ChannelType value="ChannelType::RSSL_SOCKET"/>

<CompressionType value="CompressionType::None"/>

<GuaranteedOutputBuffers value="5000"/>

<Host value="test_host1"/>

<Port value="10102"/>

</Channel>

</ChannelList>

</ChannelGroup>

<LoggerGroup>

<LoggerList>

<Logger>

<Name value="Logger_1"/>

<LoggerType value="LoggerType::Stdout"/>

<LoggerSeverity value="LoggerSeverity::Success"/>

</Logger>

</LoggerList>

</LoggerGroup>

<DictionaryGroup>

<DictionaryList>

<Dictionary>

<Name value="Dictionary_1"/>

<DictionaryType value="DictionaryType::FileDictionary"/>

<RdmFieldDictionaryFileName value="./RDMFieldDictionary"/>

<EnumTypeDefFileName value="./enumtype.def"/>

</Dictionary>

</DictionaryList>

</DictionaryGroup>

</EmaConfig>

===============================

Could you pleaes let us know how to properly configure it ? Thank you

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hello @ryusuke.kamimura

    I did a quick test with EMA API C++ version 3.6.7 (RTSDK 2.0.7) Cons410 example connects to the following sources:

    • Consumer 1: Connect to RTC/ADS Pop on my local machine port 14002
    • Consumer 2: Connect to EMA Java IProvider on my local machine port 14022

    The modification code of Cons410 is as follows:

    try {
        // Create two ConsumerManager objects to demonstrate horizontal scaling feature on user thread of control
        ConsumerManager consumerMgr1( "localhost:14002", "user1" );
        ConsumerManager consumerMgr2("localhost:14022", "user2");
            
        AppClient appClient1;
        AppClient appClient2;


        consumerMgr1.getOmmConsumer().registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( "/VOD.L" ), appClient1, (void *)"consumerMgr1" );
        consumerMgr2.getOmmConsumer().registerClient( ReqMsg().serviceName( "ELEKTRON_DD" ).name( "TRI.N" ), appClient2, (void *)"consumerMgr2" );


        // Start dispatching messages from each ConsumerManager
        consumerMgr1.start();
        consumerMgr2.start();


        sleep( 60000 );                // User thread calls onRefreshMsg(), onUpdateMsg(), or onStatusMsg()


        consumerMgr1.stop();
        consumerMgr2.stop();
    }

    Results:

    result-1.png

    result-2.png

    The EMA API Horizontal Scaling example is available on the EMA C++ as Cons410 example. The example is available on the SDK package which can be downloaded from the following sites:

Answers

  • Hello @ryusuke.kamimura

    Thank you for contacting us. Can you please clarify if you are using the RFA API (C++, Java, or . Net?) or EMA API (C++ or Java)?

    If you are using EMA API, the API doesn't support multiple hosts. However, you can use the Warm Standby feature. This feature allows a consumer to failover to a standby connection when a primary connection fails or a service is down. Because the standby server is already aware of items an application has subscribed for, during a failover APIs don't need to re-subscribe items to the standby server.

    You can find more detail about the RTSDK Warm Standby feature from the following resources:

    The EMA APIs examples for the Warm Standby feature are as follows:

    • EMA C++: Cons470
    • EMA Java: ex470_MP_WarmStandby

    Hope this helps.

  • Hi @ryusuke.kamimura,

    You are asking about RFA, but the configuration you have posted is for EMA SDK.

    Either way, there is no automatic mechanism to establish multiple connections to ADS, but an application can easily do this in the code. It does not even have to be a different IP/port; multiple connections can be established to the same ADS by instantiating a new OMMConsumer object. Each consumer will establish its own independent connection, which is unaffected by other connections.

    In practice, multiple connections to same host do not offer any advantage, since a single connection has enough bandwidth to handle all the throughput - what is your use case?

  • Hi @Gurpreet / @wasin.w

    Many thanks for your reply.

    This is not a connection to TREP/ADS, but to an internally created publisher server that runs multiple instances (and each instance provides unqiue subset of RICs) which each instance maps to a unique port. hence this query.


    Is there any way we can do this ? other than having to preparea new host per instance /port ?

  • Hello @ryusuke.kamimura

    The EMA API supports only a single host server (ADS or OMM IProvider) connection per OMMConsumer object. The channellist and warm standby are for the failover scenario.

    There is the EMA API Horizontal Scaling example (EMA Java: ex410_MP_HorizontalScaling, EMA C++:Cons410) that shows how the single application can utilize multiple OMMConsumer objects. This article aims for the horizontal scaling feature but you can modify it to connect to different sources or ports.

    If you need this feature in the future release of the SDK, you can submit an enhancement request to the product team via the following channels:

  • Hello @wasin.w

    Thank you for your reply.

    So just to confirm,

    it is possible to connect to different ports by using "EMA API Horizontal Scaling" feature that is already made available, correct ?

    Our developer is using EMA API (C++),

    could you please share us with the doc/sample config for it ?

    Thank you.

  • Hi @wasin.w


    Many thanks for your quick test and confirmation. Let us give a try on our side and get back if any further questions.