public class SimpleMessageParser extends Object implements MessageParser
{ status: {
succeeded: true,
runTimeMs: 123,
}
response: {
rowCount: 10,
rows: [
{ ... },
{ ... } ]
},
footer: "something interesting"
}
The path to the actual data would be "response/rows"
.
The message parser will "free-wheel" over all objects not on the
data path. Thus, this class will skip over the nested structure
within the status
member.
If the data path is not found then this class reports EOF of the whole data stream. It may have skipped over the actual payload if the path is mis-configured.
The payload can also be a single JSON object:
response: {
field1: "value1",
field2: "value2",
...
},
This parser "ungets" the value token (start object or start array) so that the structure parser can determine which case to handle.
MessageParser.MessageContextException
Constructor and Description |
---|
SimpleMessageParser(String dataPath) |
Modifier and Type | Method and Description |
---|---|
boolean |
parsePrefix(TokenIterator tokenizer) |
void |
parseSuffix(TokenIterator tokenizer) |
public SimpleMessageParser(String dataPath)
public boolean parsePrefix(TokenIterator tokenizer) throws MessageParser.MessageContextException
parsePrefix
in interface MessageParser
MessageParser.MessageContextException
public void parseSuffix(TokenIterator tokenizer)
parseSuffix
in interface MessageParser
Copyright © 1970 The Apache Software Foundation. All rights reserved.