Package org.apache.storm.jms.bolt
Class JmsBolt
java.lang.Object
org.apache.storm.topology.base.BaseComponent
org.apache.storm.topology.base.BaseRichBolt
org.apache.storm.topology.base.BaseTickTupleAwareRichBolt
org.apache.storm.jms.bolt.JmsBolt
- All Implemented Interfaces:
- Serializable,- IBolt,- IComponent,- IRichBolt
A JmsBolt receives 
org.apache.storm.tuple.Tuple objects from a Storm
 topology and publishes JMS Messages to a destination (topic or queue).
 To use a JmsBolt in a topology, the following must be supplied:
- A JmsProviderimplementation.
- A JmsMessageProducerimplementation.
JmsProvider provides the JMS javax.jms.ConnectionFactory
 and javax.jms.Destination objects requied to publish JMS messages.
 The JmsBolt uses a JmsMessageProducer to translate
 org.apache.storm.tuple.Tuple objects into
 javax.jms.Message objects for publishing.
 
Both JmsProvider and JmsMessageProducer must be set, or the bolt will fail upon deployment to a cluster.
The JmsBolt is typically an endpoint in a topology -- in other words it does not emit any tuples.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcleanup()Releases JMS resources.voiddeclareOutputFields(OutputFieldsDeclarer declarer) Declare the output schema for all the streams of this topology.voidprepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) Initializes JMS resources.protected voidConsumes a tuple and sends a JMS message.voidsetAutoAck(boolean autoAck) Sets whether or not tuples should be acknowledged by this bolt.voidsetJmsAcknowledgeMode(int acknowledgeMode) Sets the JMS acknowledgement mode for JMS messages sent by this bolt.voidsetJmsMessageProducer(JmsMessageProducer producer) Set the JmsMessageProducer used to convert tuples into JMS messages.voidsetJmsProvider(JmsProvider provider) Set the JmsProvider used to connect to the JMS destination topic/queue.Methods inherited from class org.apache.storm.topology.base.BaseTickTupleAwareRichBoltexecute, onTickTupleMethods inherited from class org.apache.storm.topology.base.BaseComponentgetComponentConfigurationMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.storm.topology.IComponentgetComponentConfiguration
- 
Constructor Details- 
JmsBoltpublic JmsBolt()
 
- 
- 
Method Details- 
setJmsProviderSet the JmsProvider used to connect to the JMS destination topic/queue.
- 
setJmsMessageProducerSet the JmsMessageProducer used to convert tuples into JMS messages.
- 
setJmsAcknowledgeModepublic void setJmsAcknowledgeMode(int acknowledgeMode) Sets the JMS acknowledgement mode for JMS messages sent by this bolt.Possible values: - javax.jms.Session.AUTO_ACKNOWLEDGE
- javax.jms.Session.CLIENT_ACKNOWLEDGE
- javax.jms.Session.DUPS_OK_ACKNOWLEDGE
 - Parameters:
- acknowledgeMode- (constant defined in javax.jms.Session)
 
- 
setAutoAckpublic void setAutoAck(boolean autoAck) Sets whether or not tuples should be acknowledged by this bolt.
- 
processConsumes a tuple and sends a JMS message.If autoAck is true, the tuple will be acknowledged after the message is sent. If JMS sending fails, the tuple will be failed. - Specified by:
- processin class- BaseTickTupleAwareRichBolt
- Parameters:
- input- The input tuple to be processed.
 
- 
cleanuppublic void cleanup()Releases JMS resources.- Specified by:
- cleanupin interface- IBolt
- Overrides:
- cleanupin class- BaseRichBolt
 
- 
declareOutputFieldsDescription copied from interface:IComponentDeclare the output schema for all the streams of this topology.- Parameters:
- declarer- this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream
 
- 
preparepublic void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) Initializes JMS resources.- Parameters:
- topoConf- The Storm configuration for this bolt. This is the configuration provided to the topology merged in with cluster configuration on this machine.
- context- This object can be used to get information about this task's place within the topology, including the task id and component id of this task, input and output information, etc.
- collector- The collector is used to emit tuples from this bolt. Tuples can be emitted at any time, including the prepare and cleanup methods. The collector is thread-safe and should be saved as an instance variable of this bolt object.
 
 
-