Package org.apache.storm.jms.example
Class JsonTupleProducer
- java.lang.Object
-
- org.apache.storm.jms.example.JsonTupleProducer
-
- All Implemented Interfaces:
Serializable
,JmsTupleProducer
public class JsonTupleProducer extends Object implements JmsTupleProducer
A simpleJmsTupleProducer
that expects to receive JMSTextMessage
objects with a body in JSON format. Ouputs a tuple with field name "json" and a string value containing the raw json. NOTE: Currently this implementation assumes the text is valid JSON and does not attempt to parse or validate it.- Author:
- tgoetz
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JsonTupleProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
declareOutputFields(OutputFieldsDeclarer declarer)
Declare the output fields produced by this JmsTupleProducer.Values
toTuple(javax.jms.Message msg)
Process a JMS message object to create a Values object.
-
-
-
Method Detail
-
toTuple
public Values toTuple(javax.jms.Message msg) throws javax.jms.JMSException
Description copied from interface:JmsTupleProducer
Process a JMS message object to create a Values object.- Specified by:
toTuple
in interfaceJmsTupleProducer
- Parameters:
msg
- - the JMS message- Returns:
- the Values tuple, or null if the message couldn't be processed.
- Throws:
javax.jms.JMSException
-
declareOutputFields
public void declareOutputFields(OutputFieldsDeclarer declarer)
Description copied from interface:JmsTupleProducer
Declare the output fields produced by this JmsTupleProducer.- Specified by:
declareOutputFields
in interfaceJmsTupleProducer
- Parameters:
declarer
- The OuputFieldsDeclarer for the spout.
-
-