@API(status=INTERNAL)
public class DatafeedLoopV2
extends java.lang.Object
This service will be started by calling start()
At the beginning, the BDK bot will try to retrieve the list of datafeed to which it is listening. Since each bot should only listening 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
Modifier and Type | Field and Description |
---|---|
protected com.symphony.bdk.http.api.ApiClient |
apiClient |
protected AuthSession |
authSession |
protected BdkConfig |
bdkConfig |
protected DatafeedApi |
datafeedApi |
protected RetryWithRecoveryBuilder |
retryWithRecoveryBuilder |
Constructor and Description |
---|
DatafeedLoopV2(DatafeedApi datafeedApi,
AuthSession authSession,
BdkConfig config,
UserV2 botInfo) |
Modifier and Type | Method and Description |
---|---|
protected AckId |
getAckId() |
protected void |
handleV4EventList(java.util.List<V4Event> events)
Handle a received listener by using the subscribed
RealTimeEventListener . |
protected void |
refresh() |
void |
start()
Start the datafeed events service
|
void |
stop()
Stop the datafeed events service.
|
void |
subscribe(RealTimeEventListener listener)
The bot subscribes to a
RealTimeEventListener |
void |
unsubscribe(RealTimeEventListener listener)
The bot unsubscribes to a
RealTimeEventListener |
protected final AuthSession authSession
protected final BdkConfig bdkConfig
protected final RetryWithRecoveryBuilder retryWithRecoveryBuilder
protected DatafeedApi datafeedApi
protected com.symphony.bdk.http.api.ApiClient apiClient
public DatafeedLoopV2(DatafeedApi datafeedApi, AuthSession authSession, BdkConfig config, UserV2 botInfo)
public void start() throws com.symphony.bdk.http.api.ApiException, AuthUnauthorizedException
com.symphony.bdk.http.api.ApiException
AuthUnauthorizedException
protected AckId getAckId()
public void stop()
public void subscribe(RealTimeEventListener listener)
RealTimeEventListener
subscribe
in interface DatafeedLoop
listener
- a Datafeed event listener to be subscribedpublic void unsubscribe(RealTimeEventListener listener)
RealTimeEventListener
unsubscribe
in interface DatafeedLoop
listener
- a Datafeed event listener to be unsubscribedprotected void handleV4EventList(java.util.List<V4Event> events)
RealTimeEventListener
.events
- List of Datafeed events to be handledprotected void refresh() throws AuthUnauthorizedException
AuthUnauthorizedException