question

Upvotes
Accepted
25 2 5 6

The relationship between consumer channels and consumer events

We use OmmConsumer with ChannelSet. How do we know which channel the event in OmmConsumerClient::onStatusMsg belongs to, or what other ways to receive events in conjunction with the channel they belong to?

In addition, the registered OmmConsumerClient does not receive the first successful connection event. So again it is not clear through which channel the connection is established.

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apic++consumereventschannel
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
25.3k 89 12 25

Hi @dmitry.kozhevnikov

The only place I can see where the channel name itself is reported is in the EMA log file.

However, in terms of your question - I have yet to come across multiple instances of an ADS (or other provider application) running on the same host - with each ADS/provider accepting incoming connections on unique ports.

Does the above scenario exist in your environment? If so, you could ask your Refinitiv Account team to raise an enhancement request for the ChannelInformation to include the Channel name (or you can post this request on Github)

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
11.3k 25 9 14

@dmitry.kozhevnikov

You can get information of connected server via the OmmConsumerEvent::getChannelInformation() on the OmmConsumerEvent passed in onStatusMsg() callback function.

void AppClient::onStatusMsg( const StatusMsg& statusMsg, const OmmConsumerEvent& ommEvent )
{
	cout << ommEvent.getChannelInformation().toString() << endl;
	cout << endl << "Handle: " << ommEvent.getHandle() << " Closure: " << ommEvent.getClosure() << endl;

Output:

hostname: 192.168.27.46
        IP address: not available for OmmConsumer connections
        connected component info: ads2.6.0.L1.solaris.rrg 64-bit
        channel state: active
        connection type: socket
        protocol type: Reuters wire format
        major version: 14
        minor version: 0
        ping timeout: 30

For the connection event, application can register for Login event to monitor connection status, and then use the getChannelInformation() method to get connection information. Please see the 330__Login__Streaming example application.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 89 12 25

Hi @dmitry.kozhevnikov,

You can get the hostname of the channel you are connected on via the OmmConsumerEvent e.g.

void AppClient::onRefreshMsg( const RefreshMsg& refreshMsg, const OmmConsumerEvent& ommEvent ) { cout << ommEvent.getChannelInformation().getHostname() << endl; 

The above will return the value you specified in the Channel->Host parameter in your config.

You can also be alerted to connection up/down & failover scenarios by registering interest in MMT_LOGIN related events by specifying a Client when creating your OmmConsumer e.g.

AppClient client; OmmConsumer consumer( OmmConsumerConfig().consumerName("Consumer_2").operationModel( OmmConsumerConfig::UserDispatchEnum ).username( "umer.nalla" ), client); 

As you will note I have specified 'client' as the final parameter above - this is demonstrated in example Consumer 330 Login Streaming.

The above will result in you receive a Login related Refresh and Status messages - when connected or when a connection goes down and then reconnects e.g. to a different server e.g.:

When connected: Item Name: umer.nalla Service Name: <not set> Item State: Open / Ok / None / 'Login accepted by host osboxes.' 

notice the item name is my username and host osboxes is the actual server name - rather than my local alias.

Connection lost: Item Name: <not set> Service Name: <not set> Item State: Open / Suspect / None / 'Channel is down.' 

notice item name is not set.

Connection re-established: 
Item Name: umer.nalla 
Service Name: <not set> 
Item State: Open / Ok / None / 'channel up' 

followed by: 
Item Name: umer.nalla 
Service Name: <not set> 
Item State: Open / Ok / None / 'Login accepted by host centos7-2.' 

Notice the hostname is centos7-2 - which is the 2nd server in my channel set.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25 2 5 6

Ok. But how to determine the connected channel, if multiple channels connect to different ports on the same host?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.3k 89 12 25

Hi @dmitry.kozhevnikov

Please note that the latest version of Elektron SDK v1.5.0.L1 now includes port information in the getChannelInformation() response.

ETA C and EMA C++ Changelog

ETA Java and EMA Java Changelo

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.