Package com.mapr.kafka.eventstreams
Class Streams
- java.lang.Object
-
- com.mapr.kafka.eventstreams.Streams
-
public class Streams extends java.lang.ObjectThis class provides the entry point to accessing MapR streams for analytics purposes.
The user can invoke the getMessageStore() methods to get DocumentStore object representing the underlying message store.
The static String's are field names of different fields in each message. They can be used to project specific fields while running find() on the returned DocumentStore object.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringIDField name representing the unique id of the messagestatic java.lang.StringKEYField name representing the message keystatic java.lang.StringMAX_CACHE_MEMORYConfiguration parameter that controls the maximum cache memory to use while iterating through the scanned documents(default long: 100MB)static java.lang.StringMAX_SCANNER_THREADSConfiguration parameter to set the maximum number of background threads to scan the documents(default int: 16)static java.lang.StringOFFSETField name representing offset of the messagestatic java.lang.StringPARTITIONField name representing partition id of the messagestatic java.lang.StringPRODUCERField name representing producer of the messagestatic java.lang.StringTOPICField name representing topic of the messagestatic java.lang.StringVALUEField name representing the message value(user provided message)
-
Constructor Summary
Constructors Constructor Description Streams()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.ojai.store.DocumentStoregetMessageStore(java.lang.String streamPath)Returns a read-only DocumentStore object representing the stream of the given pathstatic org.ojai.store.DocumentStoregetMessageStore(java.lang.String streamPath, java.lang.String... topics)Returns a read-only DocumentStore object representing the stream of the given path User can also provide only a subset of topics to read messages fromstatic org.ojai.store.DocumentStoregetMessageStore(java.lang.String streamPath, java.util.regex.Pattern regex)Returns a read-only DocumentStore object representing the stream of the given path User can also provide a regex representing all topics to read messages fromstatic org.ojai.store.DocumentStoregetMessageStore(java.lang.String streamPath, org.apache.hadoop.conf.Configuration conf)Returns a read-only DocumentStore object representing the stream of the given pathstatic org.ojai.store.DocumentStoregetMessageStore(java.lang.String streamPath, org.apache.hadoop.conf.Configuration conf, java.lang.String... topics)Returns a read-only DocumentStore object representing the stream of the given path User can also provide only a subset of topics to read messages fromstatic org.ojai.store.DocumentStoregetMessageStore(java.lang.String streamPath, org.apache.hadoop.conf.Configuration conf, java.util.regex.Pattern regex)Returns a read-only DocumentStore object representing the stream of the given path User can also provide a regex representing all topics to read messages fromstatic AdminnewAdmin(org.apache.hadoop.conf.Configuration c)Creates and returns an Admin instance with specified configuration.static AdminnewAdmin(org.apache.hadoop.conf.Configuration c, java.lang.String cluster)Creates and returns an Admin instance with specified configuration.static StreamDescriptornewStreamDescriptor()Creates and returns a StreamDescriptor instance.static TopicDescriptornewTopicDescriptor()Creates and returns a TopicDescriptor instance.
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
Field name representing the unique id of the message- See Also:
- Constant Field Values
-
PARTITION
public static final java.lang.String PARTITION
Field name representing partition id of the message- See Also:
- Constant Field Values
-
TOPIC
public static final java.lang.String TOPIC
Field name representing topic of the message- See Also:
- Constant Field Values
-
OFFSET
public static final java.lang.String OFFSET
Field name representing offset of the message- See Also:
- Constant Field Values
-
PRODUCER
public static final java.lang.String PRODUCER
Field name representing producer of the message- See Also:
- Constant Field Values
-
KEY
public static final java.lang.String KEY
Field name representing the message key- See Also:
- Constant Field Values
-
VALUE
public static final java.lang.String VALUE
Field name representing the message value(user provided message)- See Also:
- Constant Field Values
-
MAX_SCANNER_THREADS
public static final java.lang.String MAX_SCANNER_THREADS
Configuration parameter to set the maximum number of background threads to scan the documents(default int: 16)- See Also:
- Constant Field Values
-
MAX_CACHE_MEMORY
public static final java.lang.String MAX_CACHE_MEMORY
Configuration parameter that controls the maximum cache memory to use while iterating through the scanned documents(default long: 100MB)- See Also:
- Constant Field Values
-
-
Method Detail
-
getMessageStore
public static org.ojai.store.DocumentStore getMessageStore(java.lang.String streamPath) throws java.io.IOExceptionReturns a read-only DocumentStore object representing the stream of the given path- Parameters:
streamPath- the path to stream- Returns:
- DocumentStore object
- Throws:
java.io.IOException
-
getMessageStore
public static org.ojai.store.DocumentStore getMessageStore(java.lang.String streamPath, org.apache.hadoop.conf.Configuration conf) throws java.io.IOExceptionReturns a read-only DocumentStore object representing the stream of the given path- Parameters:
streamPath- the path to streamconf- hadoop configuration object (can be used to set specific values for max scanner threads and max cache memory)- Returns:
- DocumentStore object
- Throws:
java.io.IOException
-
getMessageStore
public static org.ojai.store.DocumentStore getMessageStore(java.lang.String streamPath, java.lang.String... topics) throws java.io.IOExceptionReturns a read-only DocumentStore object representing the stream of the given path User can also provide only a subset of topics to read messages from- Parameters:
streamPath- the path to streamtopics- list of topics to read messages from- Returns:
- DocumentStore object
- Throws:
java.io.IOException
-
getMessageStore
public static org.ojai.store.DocumentStore getMessageStore(java.lang.String streamPath, org.apache.hadoop.conf.Configuration conf, java.lang.String... topics) throws java.io.IOExceptionReturns a read-only DocumentStore object representing the stream of the given path User can also provide only a subset of topics to read messages from- Parameters:
streamPath- the path to streamconf- hadoop configuration object (can be used to set specific values for max scanner threads and max cache memory)topics- list of topics to read messages from- Returns:
- DocumentStore object
- Throws:
java.io.IOException
-
getMessageStore
public static org.ojai.store.DocumentStore getMessageStore(java.lang.String streamPath, java.util.regex.Pattern regex) throws java.io.IOExceptionReturns a read-only DocumentStore object representing the stream of the given path User can also provide a regex representing all topics to read messages from- Parameters:
streamPath- the path to streamregex- Pattern representing topics to read messages from- Returns:
- DocumentStore object
- Throws:
java.io.IOException
-
getMessageStore
public static org.ojai.store.DocumentStore getMessageStore(java.lang.String streamPath, org.apache.hadoop.conf.Configuration conf, java.util.regex.Pattern regex) throws java.io.IOExceptionReturns a read-only DocumentStore object representing the stream of the given path User can also provide a regex representing all topics to read messages from- Parameters:
streamPath- the path to streamconf- hadoop configuration object (can be used to set specific values for max scanner threads and max cache memory)regex- Pattern representing topics to read messages from- Returns:
- DocumentStore object
- Throws:
java.io.IOException
-
newAdmin
public static Admin newAdmin(org.apache.hadoop.conf.Configuration c) throws java.io.IOException
Creates and returns an Admin instance with specified configuration.- Returns:
- an instance of Admin interface
- Throws:
java.io.IOException
-
newAdmin
public static Admin newAdmin(org.apache.hadoop.conf.Configuration c, java.lang.String cluster) throws java.io.IOException
Creates and returns an Admin instance with specified configuration.- Returns:
- an instance of Admin interface
- Throws:
java.io.IOException
-
newStreamDescriptor
public static StreamDescriptor newStreamDescriptor()
Creates and returns a StreamDescriptor instance.- Returns:
- an instance of StreamDescriptor interface
-
newTopicDescriptor
public static TopicDescriptor newTopicDescriptor()
Creates and returns a TopicDescriptor instance.- Returns:
- an instance of TopicDescriptor interface
-
-