public class EventStreamFactory extends Object
EventStream
instances and
working with groups of event streams using
EventStreamConfig
and EventSchemaLoader
.
Use EventStreamFactory.builder() or one of the EventStreamFactory.from()
methods to construct an EventStreamFactory.
Example using builder():
EventStreamFactory f = EventStreamFactory.builder()
.setEventSchemaLoader(Arrays.asList("file:///path/to/schema/repo"))
// MW Stream Config URL, will use MediawikiEventStreamConfigLoader
.setEventStreamConfig(
"https://meta.wikimedia.org/w/api.php",
)
// in prod networks, we need special routing for MW API, optional.
.setHttpRoute("https://meta.wikimedia.org", "https://api-ro.wikimedia.org")
// event service to URI map config file, optional.
.setEventServiceToUriMap(
"file:///path/to/event_service_map.yaml"
)
.build()
Example using from():
EventStreamFactory f = EventStreamFactory.from(
Arrays.asList(
"https://schema.wikimedia.org/repositories/primary",
"https://schema.wikimedia.org/repositories/secondary",
),
"https://meta.wikimedia.org/w/api.php/",
);
Modifier and Type | Class and Description |
---|---|
static class |
EventStreamFactory.Builder
Builder builder pattern to construct EventStreamFactory instance.
|
Modifier and Type | Field and Description |
---|---|
protected EventSchemaLoader |
eventSchemaLoader
EventSchemaLoader instance used when constructing EventStreams.
|
protected EventStreamConfig |
eventStreamConfig
EventStreamConfig instance used when constructing EventStreams and
looking up stream configs.
|
Modifier | Constructor and Description |
---|---|
protected |
EventStreamFactory(EventSchemaLoader eventSchemaLoader,
EventStreamConfig eventStreamConfig)
Constructs a new instance of EventStreamFactory.
|
Modifier and Type | Method and Description |
---|---|
static EventStreamFactory.Builder |
builder() |
List<EventStream> |
createAllCachedEventStreams()
Creates EventStreams for all streams in our EventStreamConfig's cache.
|
EventStream |
createEventStream(String streamName)
Returns a new EventStream for this streamName using eventSchemaLoader and
eventStreamConfig.
|
List<EventStream> |
createEventStreams(Collection<String> streamNames)
Returns a List of new EventStreams using eventSchemaLoader and
eventStreamConfig.
|
List<EventStream> |
createEventStreamsMatchingSettings(Collection<String> streamNames,
Map<String,String> settingsFilters)
Creates EventStreams for the list of specified streams
with settings that match the provided settingsFilters.
|
static EventStreamFactory |
from(List<String> eventSchemaBaseUris,
String eventStreamConfigUri)
Helper function to quickly instantiate EventStreamFactory.
|
static EventStreamFactory |
from(List<String> eventSchemaBaseUris,
String eventStreamConfigUri,
Map<String,String> httpRoutes)
Helper function to quickly instantiate EventStreamFactory.
|
static EventStreamFactory |
from(List<String> eventSchemaBaseUris,
String eventStreamConfigUri,
Map<String,String> httpRoutes,
String eventServiceToUriMapUrl)
Helper function to quickly instantiate EventStreamFactory.
|
EventSchemaLoader |
getEventSchemaLoader()
Returns the EventSchemaLoader instance this EventStreamFactory is using.
|
EventStreamConfig |
getEventStreamConfig()
Returns the EventStreamConfig instance this EventStreamFactory is using.
|
protected final EventSchemaLoader eventSchemaLoader
protected EventStreamConfig eventStreamConfig
protected EventStreamFactory(EventSchemaLoader eventSchemaLoader, EventStreamConfig eventStreamConfig)
public static EventStreamFactory from(List<String> eventSchemaBaseUris, String eventStreamConfigUri)
public static EventStreamFactory from(List<String> eventSchemaBaseUris, String eventStreamConfigUri, Map<String,String> httpRoutes)
public static EventStreamFactory from(List<String> eventSchemaBaseUris, String eventStreamConfigUri, Map<String,String> httpRoutes, String eventServiceToUriMapUrl)
public static EventStreamFactory.Builder builder()
public List<EventStream> createAllCachedEventStreams()
public EventStream createEventStream(String streamName)
public List<EventStream> createEventStreams(Collection<String> streamNames)
public List<EventStream> createEventStreamsMatchingSettings(Collection<String> streamNames, Map<String,String> settingsFilters)
public EventStreamConfig getEventStreamConfig()
public EventSchemaLoader getEventSchemaLoader()
Copyright © 2025. All rights reserved.