public class EmpConnector extends Object
| Constructor and Description |
|---|
EmpConnector(BayeuxParameters parameters,
ConnectionFailureListener listener) |
| Modifier and Type | Method and Description |
|---|---|
EmpConnector |
addListener(String channel,
org.cometd.bayeux.client.ClientSessionChannel.MessageListener messageListener) |
long |
getLastReplayId(String topic) |
boolean |
isConnected() |
boolean |
isDisconnected() |
boolean |
isHandshook() |
void |
setBearerTokenProvider(Function<Boolean,String> bearerTokenProvider)
Set a bearer token / session id provider function that takes a boolean as input and returns a valid token.
|
Future<Boolean> |
start()
Start the connector.
|
void |
stop()
Stop the connector
|
Future<TopicSubscription> |
subscribe(String topic,
long replayFrom,
Consumer<Map<String,Object>> consumer)
Subscribe to a topic, receiving events after the replayFrom position
|
Future<TopicSubscription> |
subscribeEarliest(String topic,
Consumer<Map<String,Object>> consumer)
Subscribe to a topic, receiving events from the earliest event position in the stream
|
Future<TopicSubscription> |
subscribeTip(String topic,
Consumer<Map<String,Object>> consumer)
Subscribe to a topic, receiving events from the latest event position in the stream
|
public EmpConnector(BayeuxParameters parameters, ConnectionFailureListener listener)
public Future<Boolean> start()
public void stop()
public void setBearerTokenProvider(Function<Boolean,String> bearerTokenProvider)
bearerTokenProvider - a bearer token provider function.public Future<TopicSubscription> subscribe(String topic, long replayFrom, Consumer<Map<String,Object>> consumer)
topic - - the topic to subscribe toreplayFrom - - the replayFrom position in the event streamconsumer - - the consumer of the eventspublic Future<TopicSubscription> subscribeEarliest(String topic, Consumer<Map<String,Object>> consumer)
topic - - the topic to subscribe toconsumer - - the consumer of the eventspublic Future<TopicSubscription> subscribeTip(String topic, Consumer<Map<String,Object>> consumer)
topic - - the topic to subscribe toconsumer - - the consumer of the eventspublic EmpConnector addListener(String channel, org.cometd.bayeux.client.ClientSessionChannel.MessageListener messageListener)
public boolean isConnected()
public boolean isDisconnected()
public boolean isHandshook()
public long getLastReplayId(String topic)
Copyright © 2025 WSO2. All rights reserved.