public class MqttSpout extends Object implements IRichSpout, org.fusesource.mqtt.client.Listener
Modifier and Type | Field and Description |
---|---|
protected SpoutOutputCollector |
collector |
protected TopologyContext |
context |
protected LinkedBlockingQueue<org.apache.storm.mqtt.spout.AckableMessage> |
incoming |
protected KeyStoreLoader |
keyStoreLoader |
protected MqttOptions |
options |
protected HashMap<Long,org.apache.storm.mqtt.spout.AckableMessage> |
pending |
protected MqttMessageMapper |
type |
Modifier | Constructor and Description |
---|---|
protected |
MqttSpout() |
|
MqttSpout(MqttMessageMapper type,
MqttOptions options) |
|
MqttSpout(MqttMessageMapper type,
MqttOptions options,
KeyStoreLoader keyStoreLoader) |
Modifier and Type | Method and Description |
---|---|
void |
ack(Object msgId)
Storm has determined that the tuple emitted by this spout with the msgId identifier has been fully processed.
|
void |
activate() |
void |
close() |
void |
deactivate() |
void |
declareOutputFields(OutputFieldsDeclarer declarer) |
void |
fail(Object msgId)
The tuple emitted by this spout with the msgId identifier has failed to be fully processed.
|
Map<String,Object> |
getComponentConfiguration() |
void |
nextTuple()
When this method is called, Storm is requesting that the Spout emit tuples to the output collector.
|
void |
onConnected() |
void |
onDisconnected() |
void |
onFailure(Throwable throwable) |
void |
onPublish(org.fusesource.hawtbuf.UTF8Buffer topic,
org.fusesource.hawtbuf.Buffer payload,
Runnable ack) |
void |
open(Map conf,
TopologyContext context,
SpoutOutputCollector collector) |
protected transient SpoutOutputCollector collector
protected transient TopologyContext context
protected transient LinkedBlockingQueue<org.apache.storm.mqtt.spout.AckableMessage> incoming
protected transient HashMap<Long,org.apache.storm.mqtt.spout.AckableMessage> pending
protected MqttMessageMapper type
protected MqttOptions options
protected KeyStoreLoader keyStoreLoader
protected MqttSpout()
public MqttSpout(MqttMessageMapper type, MqttOptions options)
public MqttSpout(MqttMessageMapper type, MqttOptions options, KeyStoreLoader keyStoreLoader)
public void declareOutputFields(OutputFieldsDeclarer declarer)
declareOutputFields
in interface IComponent
public Map<String,Object> getComponentConfiguration()
getComponentConfiguration
in interface IComponent
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector)
public void deactivate()
deactivate
in interface ISpout
public void nextTuple()
When this method is called, Storm is requesting that the Spout emit tuples to the output collector. This method should be non-blocking, so if the Spout has no tuples to emit, this method should return. nextTuple, ack, and fail are all called in a tight loop in a single thread in the spout task. When there are no tuples to emit, it is courteous to have nextTuple sleep for a short amount of time (like a single millisecond) so as not to waste too much CPU.
public void ack(Object msgId)
Storm has determined that the tuple emitted by this spout with the msgId identifier has been fully processed. Typically, an implementation of this method will take that message off the queue and prevent it from being replayed.
public void fail(Object msgId)
The tuple emitted by this spout with the msgId identifier has failed to be fully processed. Typically, an implementation of this method will put that message back on the queue to be replayed at a later time.
public void onConnected()
onConnected
in interface org.fusesource.mqtt.client.Listener
public void onDisconnected()
onDisconnected
in interface org.fusesource.mqtt.client.Listener
public void onPublish(org.fusesource.hawtbuf.UTF8Buffer topic, org.fusesource.hawtbuf.Buffer payload, Runnable ack)
onPublish
in interface org.fusesource.mqtt.client.Listener
public void onFailure(Throwable throwable)
onFailure
in interface org.fusesource.mqtt.client.Listener
Copyright © 2016 The Apache Software Foundation. All Rights Reserved.