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.String
DEFAULT_ANALYTICS_REQUEST_PATH
Default value foranalyticsRequestPath
parameter, for the server-side SDK.static java.lang.String
DEFAULT_DIAGNOSTIC_REQUEST_PATH
Default value fordiagnosticRequestPath
parameter, for the server-side SDK.static long
DEFAULT_RETRY_DELAY_MILLIS
Default value forretryDelayMillis
parameter.
-
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 void
close()
EventSender.Result
sendAnalyticsEvents(byte[] data, int eventCount, java.net.URI eventsBaseUri)
Attempt to deliver an analytics event data payload.EventSender.Result
sendDiagnosticEvent(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 forretryDelayMillis
parameter.- See Also:
- Constant Field Values
-
DEFAULT_ANALYTICS_REQUEST_PATH
public static final java.lang.String DEFAULT_ANALYTICS_REQUEST_PATH
Default value foranalyticsRequestPath
parameter, 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 fordiagnosticRequestPath
parameter, 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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
sendAnalyticsEvents
public EventSender.Result sendAnalyticsEvents(byte[] data, int eventCount, java.net.URI eventsBaseUri)
Description copied from interface:EventSender
Attempt to deliver an analytics event data payload.This method will be called synchronously from an event delivery worker thread.
- Specified by:
sendAnalyticsEvents
in 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:EventSender
Attempt to deliver a diagnostic event data payload.This method will be called synchronously from an event delivery worker thread.
- Specified by:
sendDiagnosticEvent
in interfaceEventSender
- Parameters:
data
- the preformatted JSON data, as a stringeventsBaseUri
- the configured events endpoint base URI- Returns:
- a
EventSender.Result
-
-