public class CanaryEventProducer extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
CANARY_DOMAIN
Will be used as the value of meta.domain when building canary events.
|
protected static List<String> |
DATACENTERS
List of data center names that will be used to look up event service urls.
|
protected EventStreamFactory |
eventStreamFactory
EventStreamFactory instance used when constructing EventStreams.
|
protected static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER
Used for serializing JsonNode events to Strings.
|
Constructor and Description |
---|
CanaryEventProducer(EventSchemaLoader eventSchemaLoader,
EventStreamConfig eventStreamConfig,
BasicHttpClient httpClient)
Constructs a new instance of CanaryEventProducer with a new instance of EventStreamFactory
from eventSchemaLoader and eventStreamConfig.
|
CanaryEventProducer(EventStreamFactory eventStreamFactory,
BasicHttpClient client)
Constructs a new CanaryEventProducer using the provided EventStreamFactory.
|
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.node.ObjectNode |
canaryEvent(EventStream es)
Given an EventStream, gets its schema and uses the JSONSchema examples to make a canary event.
|
com.fasterxml.jackson.databind.node.ObjectNode |
canaryEvent(EventStream es,
org.joda.time.DateTime timestamp)
Given an EventStream, gets its schema and uses the JSONSchema examples to make a canary event.
|
com.fasterxml.jackson.databind.node.ObjectNode |
canaryEvent(String streamName)
Given a streamName, gets its schema and uses the JSONSchema examples to make a canary event.
|
com.fasterxml.jackson.databind.node.ObjectNode |
canaryEvent(String streamName,
org.joda.time.DateTime timestamp) |
static com.fasterxml.jackson.databind.node.ArrayNode |
eventsToArrayNode(List<com.fasterxml.jackson.databind.node.ObjectNode> events)
Given a List of ObjectNodes, returns an ArrayNode of those ObjectNodes.
|
Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> |
getAllCanaryEventsToPost()
Gets canary events to POST for all streams that EventStreamConfig knows about.
|
Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> |
getCanaryEventsToPost(List<String> streamNames)
Gets canary events to POST for a List of stream names.
|
Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> |
getCanaryEventsToPost(List<String> streamNames,
org.joda.time.DateTime timestamp)
Gets canary events to POST for a List of stream names.
|
Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> |
getCanaryEventsToPost(String streamName)
Gets canary events to POST for a single stream.
|
Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> |
getCanaryEventsToPost(String streamName,
org.joda.time.DateTime timestamp)
Gets canary events to POST for a single stream.
|
Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> |
getCanaryEventsToPostForStreams(List<EventStream> eventStreams,
org.joda.time.DateTime timestamp)
Given a list of streams and a timestamp, this will return a map of
datacenter specific event service URIs to a list of canary
events that should be POSTed to that event service.
|
EventStreamFactory |
getEventStreamFactory()
Returns the EventStreamFactory this CanaryEventProducer is using.
|
protected static com.fasterxml.jackson.databind.node.ObjectNode |
makeCanaryEvent(String streamName,
com.fasterxml.jackson.databind.node.ObjectNode example) |
protected static com.fasterxml.jackson.databind.node.ObjectNode |
makeCanaryEvent(String streamName,
com.fasterxml.jackson.databind.node.ObjectNode example,
org.joda.time.DateTime timestamp)
Creates a canary event from an example event for a stream.
|
Map<URI,BasicHttpResult> |
postAllCanaryEvents()
POSTs canary events for all known streams.
|
Map<URI,BasicHttpResult> |
postCanaryEvents(List<String> streamNames)
Posts canary events for each named event stream.
|
Map<URI,BasicHttpResult> |
postCanaryEvents(String streamName)
Posts canary events for a single streamName.
|
Map<URI,BasicHttpResult> |
postCanaryEventsForStreams(List<EventStream> eventStreams)
Gets canary events for each eventStream, POSTs them to the appropriate
event service url(s), and collects the results of each POST
into a Map of event service url to result ObjectNode.
|
BasicHttpResult |
postEvents(URI eventServiceUri,
List<com.fasterxml.jackson.databind.node.ObjectNode> events)
POSTs the given list of
events to the eventServiceUri.
|
Map<URI,BasicHttpResult> |
postEventsToUris(Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> uriToEvents)
Iterates over the Map of URI to events and posts events to the URI.
|
protected final EventStreamFactory eventStreamFactory
protected static final List<String> DATACENTERS
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
protected static final String CANARY_DOMAIN
public CanaryEventProducer(EventSchemaLoader eventSchemaLoader, EventStreamConfig eventStreamConfig, BasicHttpClient httpClient)
public CanaryEventProducer(EventStreamFactory eventStreamFactory, BasicHttpClient client)
@Nonnull public EventStreamFactory getEventStreamFactory()
@Nonnull public com.fasterxml.jackson.databind.node.ObjectNode canaryEvent(String streamName)
@Nonnull public com.fasterxml.jackson.databind.node.ObjectNode canaryEvent(String streamName, org.joda.time.DateTime timestamp)
@Nonnull public com.fasterxml.jackson.databind.node.ObjectNode canaryEvent(EventStream es)
@Nonnull public com.fasterxml.jackson.databind.node.ObjectNode canaryEvent(EventStream es, org.joda.time.DateTime timestamp)
@Nonnull protected static com.fasterxml.jackson.databind.node.ObjectNode makeCanaryEvent(String streamName, com.fasterxml.jackson.databind.node.ObjectNode example, org.joda.time.DateTime timestamp)
protected static com.fasterxml.jackson.databind.node.ObjectNode makeCanaryEvent(String streamName, com.fasterxml.jackson.databind.node.ObjectNode example)
@Nonnull public Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> getAllCanaryEventsToPost()
@Nonnull public Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> getCanaryEventsToPost(String streamName)
@Nonnull public Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> getCanaryEventsToPost(String streamName, org.joda.time.DateTime timestamp)
@Nonnull public Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> getCanaryEventsToPost(List<String> streamNames)
@Nonnull public Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> getCanaryEventsToPost(List<String> streamNames, org.joda.time.DateTime timestamp)
@Nonnull public Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> getCanaryEventsToPostForStreams(List<EventStream> eventStreams, org.joda.time.DateTime timestamp)
@Nonnull public Map<URI,BasicHttpResult> postAllCanaryEvents()
@Nonnull public Map<URI,BasicHttpResult> postCanaryEvents(String streamName)
@Nonnull public Map<URI,BasicHttpResult> postCanaryEvents(List<String> streamNames)
@Nonnull public Map<URI,BasicHttpResult> postCanaryEventsForStreams(List<EventStream> eventStreams)
@Nonnull public static com.fasterxml.jackson.databind.node.ArrayNode eventsToArrayNode(List<com.fasterxml.jackson.databind.node.ObjectNode> events)
@Nonnull public Map<URI,BasicHttpResult> postEventsToUris(Map<URI,List<com.fasterxml.jackson.databind.node.ObjectNode>> uriToEvents)
@Nonnull public BasicHttpResult postEvents(URI eventServiceUri, List<com.fasterxml.jackson.databind.node.ObjectNode> events)
Copyright © 2025. All rights reserved.