symphony.bdk.core.service.datafeed.datafeed_loop_v2.DatafeedLoopV2#

class symphony.bdk.core.service.datafeed.datafeed_loop_v2.DatafeedLoopV2(datafeed_api: symphony.bdk.gen.agent_api.datafeed_api.DatafeedApi, session_service: symphony.bdk.core.service.session.session_service.SessionService, auth_session: symphony.bdk.core.auth.auth_session.AuthSession, config: symphony.bdk.core.config.model.bdk_config.BdkConfig)#

Bases: symphony.bdk.core.service.datafeed.abstract_ackId_event_loop.AbstractAckIdEventLoop

A class for implementing the datafeed v2 loop service.

This service will be started by calling start().

On the very first run, the BDK bot will try to retrieve the list of datafeed to which it is listening. Since each bot should only listen to just one datafeed, the first datafeed in the list will be used by the bot to be listened to. If the retrieved list is empty, the BDK bot will create a new datafeed to listen.

The BDK bot will listen to this datafeed to get all the received real-time events.

If this datafeed becomes stale or faulty, the BDK bot will create the new one for listening.

This service will be stopped by calling stop()

If the datafeed service is stopped during a read datafeed call, it has to wait until the last read finish to be really stopped

__init__(datafeed_api: symphony.bdk.gen.agent_api.datafeed_api.DatafeedApi, session_service: symphony.bdk.core.service.session.session_service.SessionService, auth_session: symphony.bdk.core.auth.auth_session.AuthSession, config: symphony.bdk.core.config.model.bdk_config.BdkConfig)#
Parameters
  • datafeed_api – DatafeedApi to request the service

  • session_service – the SessionService to get user session information

  • auth_session – the AuthSession instance used to get session and key manager tokens

  • config – the bot configuration

Methods

__init__(datafeed_api, session_service, ...)

param datafeed_api

DatafeedApi to request the service

recreate_datafeed()

start()

Start the datafeed event service

stop([hard_kill, timeout])

Stop the datafeed event service

subscribe(listener)

Subscribes a new listener to the datafeed loop instance.

unsubscribe(listener)

Removes a given listener from the datafeed loop instance.

async start()#

Start the datafeed event service

Returns

None

async stop(hard_kill: bool = False, timeout: Optional[float] = None)#

Stop the datafeed event service

Parameters
  • hard_kill – if set to True, tasks running listener methods will be cancelled immediately. Otherwise, tasks will be awaited until completion.

  • timeout – timeout in seconds to wait for tasks completion when loop stops. None means wait until completion. Ignored if hard_kill set to True.

Returns

None

subscribe(listener: symphony.bdk.core.service.datafeed.real_time_event_listener.RealTimeEventListener)#

Subscribes a new listener to the datafeed loop instance.

Parameters

listener – the RealTimeEventListener to be added.

unsubscribe(listener: symphony.bdk.core.service.datafeed.real_time_event_listener.RealTimeEventListener)#

Removes a given listener from the datafeed loop instance.

Parameters

listener – the RealTimeEventListener to be removed.