public class ConnectClient
extends java.lang.Object
| Constructor and Description |
|---|
ConnectClient(java.lang.String projectId,
java.lang.String apiKey,
java.lang.String baseUrl,
EventStore eventStore)
Creates a new Connect client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> event)
Add an event to the event store to be delivered later.
|
void |
push(java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> event)
Synchronously push an event to a collection in Connect.
|
void |
pushAsync(java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> event,
ConnectCallback callback)
Asynchronously Push an event to a collection in Connect.
|
java.util.Map<java.lang.String,java.lang.Iterable<EventPushResponse>> |
pushBatch(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>[]> batch)
Synchronously push a batch of events to Connect.
|
void |
pushBatchAsync(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>[]> batch,
ConnectBatchCallback callback)
Asynchronously push a batch of events to Connect.
|
java.util.Map<java.lang.String,java.lang.Iterable<EventPushResponse>> |
pushPending()
Push the pending events stored to Connect synchronously.
|
void |
pushPendingAsync(ConnectBatchCallback callback)
Push the pending events stored to Connect asynchronously.
|
protected void |
updateStoreWithResponse(java.util.Map<java.lang.String,java.lang.Iterable<EventPushResponse>> details) |
public ConnectClient(java.lang.String projectId,
java.lang.String apiKey,
java.lang.String baseUrl,
EventStore eventStore)
projectId - ID of the project to which to push events.apiKey - API key used to access the project (this must be a push or push/query key).baseUrl - Base URL of the Connect API.eventStore - EventStore used for persistence.public void push(java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> event)
throws ConnectException
collection - Name of the collection to which to push the event.event - Event to push to the collection.InvalidEventException - If the server instructs that the event or its properties are invalid.ConnectException - When an error occurs.
Will be InvalidEventException, ServerException
or a generic ConnectException with an inner exception.public void pushAsync(java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> event,
ConnectCallback callback)
collection - Name of the collection to which to push the event.event - Event to push to the collection.callback - A ConnectCallback that will be invoked with the result of the request.public java.util.Map<java.lang.String,java.lang.Iterable<EventPushResponse>> pushBatch(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>[]> batch) throws ConnectException
batch - A Map of collection name to events for which to push to Connect.Map of collection name to an array of responses to individual event pushes in the same order as the request.ConnectException - When an error occurs.
Will be InvalidEventException,
or a generic ConnectException with an inner exception.public void pushBatchAsync(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>[]> batch,
ConnectBatchCallback callback)
batch - A Map with collection name as a key and event Maps as values.callback - A ConnectBatchCallback that will be invoked with the result of the request.public void add(java.lang.String collection,
java.util.Map<java.lang.String,java.lang.Object> event)
throws ConnectException
collection - Name of the collection to which to push the event.event - Event to add to the collection.ConnectException - When an error occurs.
Will be InvalidEventException or a generic ConnectException with an inner exception.public java.util.Map<java.lang.String,java.lang.Iterable<EventPushResponse>> pushPending() throws ConnectException
Map of collection name to an array of responses to individual events pushed from the queue.ConnectException - When an error occurs.
Will be InvalidEventException,
or a generic ConnectException with an inner exception.public void pushPendingAsync(ConnectBatchCallback callback)
callback - A ConnectBatchCallback that will be invoked with the result of the request.protected void updateStoreWithResponse(java.util.Map<java.lang.String,java.lang.Iterable<EventPushResponse>> details)