Package org.apache.storm.multilang

## Class JsonSerializer

- java.lang.Object
- - org.apache.storm.multilang.JsonSerializer

- All Implemented Interfaces:
    `Serializable`, `ISerializer`

      public class JsonSerializer
      extends Object
      implements ISerializer

  JsonSerializer implements the JSON multilang protocol.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `DEFAULT_CHARSET` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JsonSerializer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Number` | `connect​(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.
    `ShellMsg` | `readShellMsg()` | 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_CHARSET

          public static final String DEFAULT_CHARSET

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JsonSerializer

          public JsonSerializer()

  - ### Method Detail

    - #### initialize

          public void initialize​(OutputStream processIn,
                                 InputStream processOut)

      Description copied from interface: `ISerializer`
      This method sets the input and output streams of the serializer.
      Specified by:
        `initialize` in interface `ISerializer`
      Parameters:
        `processIn` - output stream to non-JVM component
        `processOut` - input stream from non-JVM component

    - #### connect

          public Number connect​(Map<String,​Object> conf,
                                TopologyContext context)
                         throws IOException,
                                NoOutputException

      Description copied from interface: `ISerializer`
      This method transmits the Storm config to the non-JVM process and receives its pid.
      Specified by:
        `connect` in interface `ISerializer`
      Parameters:
        `conf` - storm configuration
        `context` - topology context
      Returns:
        process pid
      Throws:
        `IOException`
        `NoOutputException`

    - #### writeBoltMsg

          public void writeBoltMsg​(BoltMsg boltMsg)
                            throws IOException

      Description copied from interface: `ISerializer`
      This method sends a bolt message to a non-JVM bolt process.
      Specified by:
        `writeBoltMsg` in interface `ISerializer`
      Parameters:
        `boltMsg` - bolt message
      Throws:
        `IOException`

    - #### writeSpoutMsg

          public void writeSpoutMsg​(SpoutMsg msg)
                             throws IOException

      Description copied from interface: `ISerializer`
      This method sends a spout message to a non-JVM spout process.
      Specified by:
        `writeSpoutMsg` in interface `ISerializer`
      Parameters:
        `msg` - spout message
      Throws:
        `IOException`

    - #### writeTaskIds

          public void writeTaskIds​(List<Integer> taskIds)
                            throws IOException

      Description copied from interface: `ISerializer`
      This method sends a list of task IDs to a non-JVM bolt process.
      Specified by:
        `writeTaskIds` in interface `ISerializer`
      Parameters:
        `taskIds` - list of task IDs
      Throws:
        `IOException`

    - #### readShellMsg

          public ShellMsg readShellMsg()
                                throws IOException,
                                       NoOutputException

      Description copied from interface: `ISerializer`
      This method receives a shell message from the non-JVM process.
      Specified by:
        `readShellMsg` in interface `ISerializer`
      Returns:
        shell message
      Throws:
        `IOException`
        `NoOutputException`