https://github.com/sqreen/javastandalonesdk
Sqreen Java SDK with no Agent dependency
https://github.com/sqreen/javastandalonesdk
Last synced: 4 months ago
JSON representation
Sqreen Java SDK with no Agent dependency
- Host: GitHub
- URL: https://github.com/sqreen/javastandalonesdk
- Owner: sqreen
- License: mit
- Created: 2020-03-31T11:02:08.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-27T12:53:42.000Z (about 5 years ago)
- Last Synced: 2025-02-02T07:25:23.598Z (over 1 year ago)
- Language: Java
- Size: 129 KB
- Stars: 1
- Watchers: 7
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Java Standalone SDK
===================
Client for submission of signals to [Sqreen’s signal ingestion
endpoint](https://ingestion.sqreen.com/). Usage of the [Sqreen
Agent](https://docs.sqreen.com/java/introduction/) is not required, although
facilities are provided to read the service’s credentials used by the agent
(requires version >= 2.0 of the Agent).
This library currently provides little in the way of structure for the signals
themselves. Only the bare syntactic general requirements of the signals are
enforced. Because the Signal type itself is so generic, the library does not
actually help writing signals that the ingestion backend understands.
The API actually accepts also arbitrary objects and lets the user configure its
serialization to the format that the ingestion endpoint expects.
Put another way, this is currently a fairly low-level library.
Bare Usage of the Client
------------------------
```java
// import io.sqreen.sasdk.backend.*;
IngestionHttpClient.WithAuthentication service = new IngestionHttpClientBuilder()
.buildingHttpClient()
.withConnectionTimeoutInMs(5000)
.withReadTimeoutInMs(10000)
.withProxy("http://proxy.com/")
.buildHttpClient()
.withErrorListener(IngestionErrorListener.LoggingIngestionErrorListener.INSTANCE)
.createWithAuthentication(
IngestionHttpClientBuilder.authConfigWithAPIKey("apiKey", "appName"));
service.reportSignal(mySignal);
service.close();
```
Requests are run synchronously.
Batch collector
---------------
Signals can also be batched. The batches are sent once a certain number of
objects have been collected or once certain time passes.
```java
BatchCollector coll = BatchCollector.builder(service)
.withTriggerSize(10)
.withMaxConcurrentRequests(3)
.withMaxQueueSize(50)
.withMaxDelayInMs(30000)
.build();
coll.add(mySignal);
coll.close();
```
`BatchCollector` does not take ownership of `service`, which must still be
closed separately.