Class DefaultEventSender
- java.lang.Object
-
- com.launchdarkly.sdk.internal.events.DefaultEventSender
-
- All Implemented Interfaces:
EventSender,java.io.Closeable,java.lang.AutoCloseable
public final class DefaultEventSender extends java.lang.Object implements EventSender
The default implementation of delivering JSON data to an LaunchDarkly event endpoint. This is the only implementation that is used by the SDKs. It is abstracted out with an interface for the sake of testability.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.launchdarkly.sdk.internal.events.EventSender
EventSender.Result
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_ANALYTICS_REQUEST_PATHDefault value foranalyticsRequestPathparameter, for the server-side SDK.static java.lang.StringDEFAULT_DIAGNOSTIC_REQUEST_PATHDefault value fordiagnosticRequestPathparameter, for the server-side SDK.static longDEFAULT_RETRY_DELAY_MILLISDefault value forretryDelayMillisparameter.
-
Constructor Summary
Constructors Constructor Description DefaultEventSender(HttpProperties httpProperties, java.lang.String analyticsRequestPath, java.lang.String diagnosticRequestPath, long retryDelayMillis, com.launchdarkly.logging.LDLogger logger)Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()EventSender.ResultsendAnalyticsEvents(byte[] data, int eventCount, java.net.URI eventsBaseUri)Attempt to deliver an analytics event data payload.EventSender.ResultsendDiagnosticEvent(byte[] data, java.net.URI eventsBaseUri)Attempt to deliver a diagnostic event data payload.
-
-
-
Field Detail
-
DEFAULT_RETRY_DELAY_MILLIS
public static final long DEFAULT_RETRY_DELAY_MILLIS
Default value forretryDelayMillisparameter.- See Also:
- Constant Field Values
-
DEFAULT_ANALYTICS_REQUEST_PATH
public static final java.lang.String DEFAULT_ANALYTICS_REQUEST_PATH
Default value foranalyticsRequestPathparameter, for the server-side SDK. The Android SDK should modify this value.- See Also:
- Constant Field Values
-
DEFAULT_DIAGNOSTIC_REQUEST_PATH
public static final java.lang.String DEFAULT_DIAGNOSTIC_REQUEST_PATH
Default value fordiagnosticRequestPathparameter, for the server-side SDK. The Android SDK should modify this value.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultEventSender
public DefaultEventSender(HttpProperties httpProperties, java.lang.String analyticsRequestPath, java.lang.String diagnosticRequestPath, long retryDelayMillis, com.launchdarkly.logging.LDLogger logger)
Creates an instance.- Parameters:
httpProperties- the HTTP configurationanalyticsRequestPath- the request path for posting analytics eventsdiagnosticRequestPath- the request path for posting diagnostic eventsretryDelayMillis- retry delay, or zero to use the defaultlogger- the logger
-
-
Method Detail
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
sendAnalyticsEvents
public EventSender.Result sendAnalyticsEvents(byte[] data, int eventCount, java.net.URI eventsBaseUri)
Description copied from interface:EventSenderAttempt to deliver an analytics event data payload.This method will be called synchronously from an event delivery worker thread.
- Specified by:
sendAnalyticsEventsin interfaceEventSender- Parameters:
data- the preformatted JSON data, in UTF-8 encodingeventCount- the number of individual events in the dataeventsBaseUri- the configured events endpoint base URI- Returns:
- a
EventSender.Result
-
sendDiagnosticEvent
public EventSender.Result sendDiagnosticEvent(byte[] data, java.net.URI eventsBaseUri)
Description copied from interface:EventSenderAttempt to deliver a diagnostic event data payload.This method will be called synchronously from an event delivery worker thread.
- Specified by:
sendDiagnosticEventin interfaceEventSender- Parameters:
data- the preformatted JSON data, as a stringeventsBaseUri- the configured events endpoint base URI- Returns:
- a
EventSender.Result
-
-