Package org.apache.storm.multilang
Class JsonSerializer
java.lang.Object
org.apache.storm.multilang.JsonSerializer
- All Implemented Interfaces:
Serializable
,ISerializer
JsonSerializer implements the JSON multilang protocol.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconnect
(Map<String, Object> conf, TopologyContext context) This method transmits the Storm config to the non-JVM process and receives its pid.void
initialize
(OutputStream processIn, InputStream processOut) This method sets the input and output streams of the serializer.This method receives a shell message from the non-JVM process.void
writeBoltMsg
(BoltMsg boltMsg) This method sends a bolt message to a non-JVM bolt process.void
writeSpoutMsg
(SpoutMsg msg) This method sends a spout message to a non-JVM spout process.void
writeTaskIds
(List<Integer> taskIds) This method sends a list of task IDs to a non-JVM bolt process.
-
Field Details
-
DEFAULT_CHARSET
- See Also:
-
-
Constructor Details
-
JsonSerializer
public JsonSerializer()
-
-
Method Details
-
initialize
Description copied from interface:ISerializer
This method sets the input and output streams of the serializer.- Specified by:
initialize
in interfaceISerializer
- Parameters:
processIn
- output stream to non-JVM componentprocessOut
- input stream from non-JVM component
-
connect
public Number connect(Map<String, Object> conf, TopologyContext context) throws IOException, NoOutputExceptionDescription copied from interface:ISerializer
This method transmits the Storm config to the non-JVM process and receives its pid.- Specified by:
connect
in interfaceISerializer
- Parameters:
conf
- storm configurationcontext
- topology context- Returns:
- process pid
- Throws:
IOException
NoOutputException
-
writeBoltMsg
Description copied from interface:ISerializer
This method sends a bolt message to a non-JVM bolt process.- Specified by:
writeBoltMsg
in interfaceISerializer
- Parameters:
boltMsg
- bolt message- Throws:
IOException
-
writeSpoutMsg
Description copied from interface:ISerializer
This method sends a spout message to a non-JVM spout process.- Specified by:
writeSpoutMsg
in interfaceISerializer
- Parameters:
msg
- spout message- Throws:
IOException
-
writeTaskIds
Description copied from interface:ISerializer
This method sends a list of task IDs to a non-JVM bolt process.- Specified by:
writeTaskIds
in interfaceISerializer
- Parameters:
taskIds
- list of task IDs- Throws:
IOException
-
readShellMsg
Description copied from interface:ISerializer
This method receives a shell message from the non-JVM process.- Specified by:
readShellMsg
in interfaceISerializer
- Returns:
- shell message
- Throws:
IOException
NoOutputException
-