Interface EventStream.Protocol<ParsedT,ItemT>
-
- Enclosing class:
- EventStream<ResponseT extends AsyncResponse,ItemT>
public static interface EventStream.Protocol<ParsedT,ItemT>Protocol interface that defines how to parse and process different event stream formats
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StreamingParser<ParsedT>createParser()Create a new parser instance for this protocolItemTprocessItem(ParsedT parsed, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.core.type.TypeReference<ItemT> typeReference)Process a parsed item and convert it to the target typebooleanshouldStop(ParsedT parsed)Check if processing should stop (e.g., terminal message encountered)
-
-
-
Method Detail
-
createParser
StreamingParser<ParsedT> createParser()
Create a new parser instance for this protocol
-
processItem
ItemT processItem(ParsedT parsed, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.core.type.TypeReference<ItemT> typeReference) throws java.lang.Exception
Process a parsed item and convert it to the target type- Parameters:
parsed- the parsed item from the parserobjectMapper- the ObjectMapper for deserializationtypeReference- the target type reference- Returns:
- the converted item, or null if this item should be skipped
- Throws:
java.lang.Exception- if conversion fails
-
shouldStop
boolean shouldStop(ParsedT parsed)
Check if processing should stop (e.g., terminal message encountered)- Parameters:
parsed- the parsed item- Returns:
- true if processing should stop
-
-