Deserializing a Spark Dstream <p>I am trying to apply Drools Engine (Drools Fusion) over streaming data using Spark Streaming.</p> <p>But I am unable to deserialize a variable of type JavaDStreamto fire rules over it.</p> <p>It is showing comparision error between JavaDstream and Interger. Please suggest how to resolve this. Below is the Code</p> <p>Main class</p> <pre><code>SparkConf conf = new SparkConf().setMaster("local[2]").setAppName("Spark Streaming"); JavaStreamingContext jssc = new JavaStreamingContext(conf, new Duration(10000)); JavaReceiverInputDStream&lt;String&gt; lines = jssc.socketTextStream("localhost", 8089); class splitFunc implements Function&lt;String, Long&gt; { public Long call(String x) { return Long.parseLong(x); } } JavaDStream&lt;Long&gt; in_amount = lines.map(new splitFunc()); insertEvent(entryPointStoreOne,new Sale(),in_amount); </code></pre> <p>Sale.java - FACTS</p> <pre><code>import org.apache.spark.streaming.api.java.JavaDStream; public class Sale { private JavaDStream&lt;Long&gt; amount; public Sale (){ } public void setAmount(JavaDStream&lt;Long&gt; amount) { this.amount=amount; } public JavaDStream&lt;Long&gt; getAmount() { return amount; } </code></pre> <p>}</p> <p>Drools Rules File</p> <pre><code>declare Sale @role(event) end rule "Store One - Has Passed its Sales Record" when $amount : Sale( amount &gt; 1000 ) - FAILING HERE from entry-point StoreOne then System.out.println("Store One has passed its Sales Records"); end </code></pre>