blob: 41a1eb9017d512f3d7ef271f34eb4124645dad14 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_112) on Mon Dec 18 11:25:21 EST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>MqttStreams (Apache Edgent (incubating) v1.2.0 API)</title>
<meta name="date" content="2017-12-18">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MqttStreams (Apache Edgent (incubating) v1.2.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/MqttStreams.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttConfig.html" title="class in org.apache.edgent.connectors.mqtt"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/edgent/connectors/mqtt/MqttStreams.html" target="_top">Frames</a></li>
<li><a href="MqttStreams.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.edgent.connectors.mqtt</div>
<h2 title="Class MqttStreams" class="title">Class MqttStreams</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.edgent.connectors.mqtt.MqttStreams</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">MqttStreams</span>
extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block"><code>MqttStreams</code> is a connector to a MQTT messaging broker
for publishing and subscribing to topics.
<p>
For more information about MQTT see <a href="http://mqtt.org">http://mqtt.org</a>
<p>
The connector exposes all MQTT capabilities:
<ul>
<li>multiple server URLs using tcp or ssl</li>
<li>connection ClientId control</li>
<li>connection username and password based authentication</li>
<li>TODO SSL connection client authentication Q:expose just key/trust store path/pw or whole setSSLProperties capability? Related: expose setSocketFactory?</li>
<li>connection clean session control</li>
<li>connection keepalive control</li>
<li>operation/action timeout control</li>
<li>client last will and testament</li>
<li>connection in-flight message persistence control</li>
<li>per-published message control of topic, quality of service, payload and retain value</li>
<li>subscription topicFilter and maximum quality of service control</li>
<li>TODO multiple subscription topicFilters</li>
<li>access to received message's topic and payload.
Omitting until there's a clear demand for it: the received msg's isRetained, qos and isDuplicate values.
<li>TODO dynamic server URLs control, operation timeout, keepalive control</li>
<li>TODO dynamic subscription list control</li>
<li>robust connection management / reconnected</li>
<li>TODO fix: client's aren't gracefully disconnecting (their close() isn't getting called) issue#64</li>
</ul>
<p>
Sample use:
<pre><code>
Topology t = ...;
String url = "tcp://localhost:1883";
MqttStreams mqtt = new MqttStreams(t, url);
TStream&lt;String&gt; s = top.constants("one", "two", "three");
mqtt.publish(s, "myTopic", 0);
TStream&lt;String&gt; rcvd = mqtt.subscribe("someTopic", 0);
rcvd.print();
</code></pre>
<P>
<code>publish()</code> can be called zero or more times.
<code>subscribe()</code> can be called at most once.
<p>
See <a href="../../../../../org/apache/edgent/connectors/mqtt/MqttConfig.html" title="class in org.apache.edgent.connectors.mqtt"><code>MqttConfig</code></a> for all configuration items.
<p>
Messages are delivered with the specified Quality of Service.
TODO adjust the QoS-1 and 2 descriptions based on the fact that we only
supply a MemoryPersistence class under the covers.
<ul>
<li>Quality of Service 0 - a message should be delivered at most once
(zero or one times) - "fire and forget".
This is the fastest QoS but should only be used for messages which
are not valuable.</li>
<li>Quality of Service 1 - a message should be delivered at least once
(zero or more times).
The message will be acknowledged across the network.</li>
<li>Quality of Service 2 = a message should be delivered once.
Delivery is subject to two-phase acknowledgment across the network.</li>
</ul>
For <code>subscribe()</code>, the QoS is the maximum QoS used for a message.
If a message was published with a QoS less then the subscribe's QoS,
the message will be received with the published QoS,
otherwise it will be received with the subscribe's QoS.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#MqttStreams-org.apache.edgent.topology.Topology-java.lang.String-java.lang.String-">MqttStreams</a></span>(<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a>&nbsp;topology,
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;url,
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;clientId)</code>
<div class="block">Create a connector to the specified server.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#MqttStreams-org.apache.edgent.topology.Topology-org.apache.edgent.function.Supplier-">MqttStreams</a></span>(<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a>&nbsp;topology,
<a href="../../../../../org/apache/edgent/function/Supplier.html" title="interface in org.apache.edgent.function">Supplier</a>&lt;<a href="../../../../../org/apache/edgent/connectors/mqtt/MqttConfig.html" title="class in org.apache.edgent.connectors.mqtt">MqttConfig</a>&gt;&nbsp;config)</code>
<div class="block">Create a connector with the specified configuration.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#publish-org.apache.edgent.topology.TStream-java.lang.String-int-boolean-">publish</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;stream,
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;topic,
int&nbsp;qos,
boolean&nbsp;retain)</code>
<div class="block">Publish a <code>TStream&lt;String&gt;</code> stream's tuples as MQTT messages.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#publish-org.apache.edgent.topology.TStream-org.apache.edgent.function.Function-org.apache.edgent.function.Function-org.apache.edgent.function.Function-org.apache.edgent.function.Function-">publish</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;T&gt;&nbsp;stream,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;topic,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,byte[]&gt;&nbsp;payload,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>&gt;&nbsp;qos,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&gt;&nbsp;retain)</code>
<div class="block">Publish a stream's tuples as MQTT messages.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#subscribe-java.lang.String-int-">subscribe</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;topicFilter,
int&nbsp;qos)</code>
<div class="block">Subscribe to the MQTT topic(s) and create a <code>TStream&lt;String&gt;</code>.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#subscribe-java.lang.String-int-org.apache.edgent.function.BiFunction-">subscribe</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;topicFilter,
int&nbsp;qos,
<a href="../../../../../org/apache/edgent/function/BiFunction.html" title="interface in org.apache.edgent.function">BiFunction</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,byte[],T&gt;&nbsp;message2Tuple)</code>
<div class="block">Subscribe to the MQTT topic(s) and create a stream of tuples of type <code>T</code>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#topology--">topology</a></span>()</code>
<div class="block">Get the <a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology"><code>Topology</code></a> the connector is associated with.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="MqttStreams-org.apache.edgent.topology.Topology-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MqttStreams</h4>
<pre>public&nbsp;MqttStreams(<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a>&nbsp;topology,
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;url,
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;clientId)</pre>
<div class="block">Create a connector to the specified server.
<p>
A convenience function.
Connecting to the server occurs after the
topology is submitted for execution.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topology</code> - the connector's associated <code>Topology</code>.</dd>
<dd><code>url</code> - URL of MQTT server.</dd>
<dd><code>clientId</code> - the connector's MQTT clientId. auto-generated if null.</dd>
</dl>
</li>
</ul>
<a name="MqttStreams-org.apache.edgent.topology.Topology-org.apache.edgent.function.Supplier-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MqttStreams</h4>
<pre>public&nbsp;MqttStreams(<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a>&nbsp;topology,
<a href="../../../../../org/apache/edgent/function/Supplier.html" title="interface in org.apache.edgent.function">Supplier</a>&lt;<a href="../../../../../org/apache/edgent/connectors/mqtt/MqttConfig.html" title="class in org.apache.edgent.connectors.mqtt">MqttConfig</a>&gt;&nbsp;config)</pre>
<div class="block">Create a connector with the specified configuration.
<p>
Connecting to the server occurs after the
topology is submitted for execution.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topology</code> - the Topology to add to</dd>
<dd><code>config</code> - <a href="../../../../../org/apache/edgent/connectors/mqtt/MqttConfig.html" title="class in org.apache.edgent.connectors.mqtt"><code>MqttConfig</code></a> supplier.</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="publish-org.apache.edgent.topology.TStream-org.apache.edgent.function.Function-org.apache.edgent.function.Function-org.apache.edgent.function.Function-org.apache.edgent.function.Function-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>publish</h4>
<pre>public&nbsp;&lt;T&gt;&nbsp;<a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;T&gt;&nbsp;publish(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;T&gt;&nbsp;stream,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;topic,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,byte[]&gt;&nbsp;payload,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>&gt;&nbsp;qos,
<a href="../../../../../org/apache/edgent/function/Function.html" title="interface in org.apache.edgent.function">Function</a>&lt;T,<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</a>&gt;&nbsp;retain)</pre>
<div class="block">Publish a stream's tuples as MQTT messages.
<p>Each tuple is published as an MQTT message with
the supplied functions providing the message topic, payload
and QoS. The topic and QoS can be generated based upon the tuple.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - Tuple type</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>stream</code> - Stream to be published.</dd>
<dd><code>topic</code> - function to supply the message's topic.</dd>
<dd><code>payload</code> - function to supply the message's payload.</dd>
<dd><code>qos</code> - function to supply the message's delivery Quality of Service.</dd>
<dd><code>retain</code> - function to supply the message's retain value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>TSink sink element representing termination of this stream.</dd>
</dl>
</li>
</ul>
<a name="publish-org.apache.edgent.topology.TStream-java.lang.String-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>publish</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/edgent/topology/TSink.html" title="interface in org.apache.edgent.topology">TSink</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;publish(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;stream,
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;topic,
int&nbsp;qos,
boolean&nbsp;retain)</pre>
<div class="block">Publish a <code>TStream&lt;String&gt;</code> stream's tuples as MQTT messages.
<p>
A convenience function.
The payload of each message is the String tuple's value serialized as UTF-8.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>stream</code> - Stream to be published.</dd>
<dd><code>topic</code> - the fixed topic.</dd>
<dd><code>qos</code> - the fixed delivery Quality of Service.</dd>
<dd><code>retain</code> - the fixed retain value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>TSink sink element representing termination of this stream.</dd>
</dl>
</li>
</ul>
<a name="subscribe-java.lang.String-int-org.apache.edgent.function.BiFunction-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>subscribe</h4>
<pre>public&nbsp;&lt;T&gt;&nbsp;<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;T&gt;&nbsp;subscribe(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;topicFilter,
int&nbsp;qos,
<a href="../../../../../org/apache/edgent/function/BiFunction.html" title="interface in org.apache.edgent.function">BiFunction</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,byte[],T&gt;&nbsp;message2Tuple)</pre>
<div class="block">Subscribe to the MQTT topic(s) and create a stream of tuples of type <code>T</code>.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - Tuple type</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topicFilter</code> - the topic(s) to subscribe to.</dd>
<dd><code>qos</code> - the maximum Quality of Service to use.</dd>
<dd><code>message2Tuple</code> - function to convert <code>(topic, payload)</code> to
a tuple of type <code>T</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>TStream&lt;T&gt;</code></dd>
</dl>
</li>
</ul>
<a name="subscribe-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>subscribe</h4>
<pre>public&nbsp;&lt;T&gt;&nbsp;<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;subscribe(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;topicFilter,
int&nbsp;qos)</pre>
<div class="block">Subscribe to the MQTT topic(s) and create a <code>TStream&lt;String&gt;</code>.
<p>
A convenience function.
Each message's payload is expected/required to be a UTF-8 encoded string.
Only the converted payload is present the generated tuple.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - Tuple type</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>topicFilter</code> - the topic(s) to subscribe to.</dd>
<dd><code>qos</code> - the maximum Quality of Service to use.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>TStream&lt;String&gt;</code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttStreams.html#publish-org.apache.edgent.topology.TStream-java.lang.String-int-boolean-"><code>publish(TStream, String, int, boolean)</code></a></dd>
</dl>
</li>
</ul>
<a name="topology--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>topology</h4>
<pre>public&nbsp;<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a>&nbsp;topology()</pre>
<div class="block">Get the <a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology"><code>Topology</code></a> the connector is associated with.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/MqttStreams.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/edgent/connectors/mqtt/MqttConfig.html" title="class in org.apache.edgent.connectors.mqtt"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/edgent/connectors/mqtt/MqttStreams.html" target="_top">Frames</a></li>
<li><a href="MqttStreams.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2016&#x2013;2017 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>