Class AbstractAckIdEventLoop
java.lang.Object
com.symphony.bdk.core.service.datafeed.impl.AbstractAckIdEventLoop
- All Implemented Interfaces:
DatafeedLoop
- Direct Known Subclasses:
DatafeedLoopV2
,DatahoseLoopImpl
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected final AuthSession
protected final com.symphony.bdk.core.config.model.BdkConfig
protected final UserV2
protected DatafeedApi
protected static final String
Initial ack ID value when starting the loopprotected final AtomicBoolean
-
Constructor Summary
ConstructorDescriptionAbstractAckIdEventLoop
(DatafeedApi datafeedApi, AuthSession authSession, com.symphony.bdk.core.config.model.BdkConfig config, UserV2 botInfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
handleV4EventList
(List<V4Event> events) Handle a received listener by using the subscribedRealTimeEventListener
.long
The timestamp of the last successful pullingprotected Void
protected abstract V5EventList
protected void
refresh()
protected abstract void
runLoop()
void
start()
Start the datafeed events servicevoid
stop()
Stop the datafeed events service.void
subscribe
(RealTimeEventListener listener) The bot subscribes to aRealTimeEventListener
void
unsubscribe
(RealTimeEventListener listener) The bot unsubscribes to aRealTimeEventListener
-
Field Details
-
INITIAL_ACK_ID
Initial ack ID value when starting the loop- See Also:
-
ackId
-
authSession
-
bdkConfig
protected final com.symphony.bdk.core.config.model.BdkConfig bdkConfig -
botInfo
-
started
-
datafeedApi
-
-
Constructor Details
-
AbstractAckIdEventLoop
public AbstractAckIdEventLoop(DatafeedApi datafeedApi, AuthSession authSession, com.symphony.bdk.core.config.model.BdkConfig config, UserV2 botInfo)
-
-
Method Details
-
readAndHandleEvents
- Throws:
com.symphony.bdk.http.api.ApiException
-
readEvents
- Throws:
com.symphony.bdk.http.api.ApiException
-
subscribe
The bot subscribes to aRealTimeEventListener
- Specified by:
subscribe
in interfaceDatafeedLoop
- Parameters:
listener
- a Datafeed event listener to be subscribed
-
unsubscribe
The bot unsubscribes to aRealTimeEventListener
- Specified by:
unsubscribe
in interfaceDatafeedLoop
- Parameters:
listener
- a Datafeed event listener to be unsubscribed
-
start
Start the datafeed events service- Specified by:
start
in interfaceDatafeedLoop
- Throws:
AuthUnauthorizedException
com.symphony.bdk.http.api.ApiException
-
runLoop
- Throws:
Throwable
-
stop
public void stop()Stop the datafeed events service. The datafeed service will be stopped after a small delay to finish the last read datafeed call.- Specified by:
stop
in interfaceDatafeedLoop
-
handleV4EventList
Handle a received listener by using the subscribedRealTimeEventListener
.- Parameters:
events
- List of Datafeed events to be handled- Throws:
RequeueEventException
- Raised if a listener fails and the developer wants to explicitly not update the ack id.
-
refresh
- Throws:
AuthUnauthorizedException
-
lastPullTimestamp
public long lastPullTimestamp()The timestamp of the last successful pulling- Specified by:
lastPullTimestamp
in interfaceDatafeedLoop
- Returns:
- timestamp value in long
-